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

mssqlnative driver object incompatible with PHP 7.2

XMLWordPrintable

      Yet another MSSQL abstraction layer bug that went out without regression testing.

      When running the current 3.2.3 build against PHP 7.2. (specifically tested 7.2.11) it fails on line 271 of /phpbb/db/driver/mssqlnative.php:

      return (count($row)) ? $row : false;

      The exception is:

      [phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mssqlnative.php on line 271count(): Parameter must be an array or an object that implements Countable

      A simple fix is to change this code:

      if ($row)
      {
      	foreach ($row as $key => $value)
      	{
      		$row[$key] = ($value === ' ' || $value === null) ? '' : $value;
      	}	// remove helper values from LIMIT queries
      	if (isset($row['line2']))
      	{
      		unset($row['line2'], $row['line3']);
      	}
      }
      return (count($row)) ? $row : false;
      
      

      To this:

      if ($row)
      {
      	foreach ($row as $key => $value)
      	{
      		$row[$key] = ($value === ' ' || $value === null) ? '' : $value;
      	}	// remove helper values from LIMIT queries
      	if (isset($row['line2']))
      	{
      		unset($row['line2'], $row['line3']);
      	}
      	return $row;
      }
      return false;
      
      

       

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

              Created:
              Updated:
              Resolved: