Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-15665

MSSQL implementation crashes when upload directory > 2GB

XMLWordPrintable

      The cast_expr_to_bigint function is not implemented in the MSSQL abstraction layer, and as a result, all numeric values being written to the database which should be a BIGINT are being handled instead as INT. As a result, when the upload directory exceeds 2GB, the update of the upload_dir_size in phpbb_config fails with:

      SQLSTATE: 22003 code: 8115 message: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Arithmetic overflow error converting expression to data type int. SQLSTATE: 01000 code: 3621 message: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]The statement has been terminated. [3621]

      UPDATE phpbb_config SET config_value = config_value + 157133 WHERE config_name = 'upload_dir_size'

      To fix this problem, the mssql_base.php file needs an implementation of cast_expr_to_bigint:

      function cast_expr_to_bigint($expression)
      {
           return 'CONVERT(BIGINT, ' . $expression . ')';
      }

      Including this code fixes the problem.

       

            Marc Marc
            gsmaclean gsmaclean
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: