Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-16883

Install file updater diff.php - Uncaught TypeError: count(): Argument must be of type Countable|array

    XMLWordPrintable

Details

    Description

      Running installer "Update files" leads to an exception in diff.php:  

      PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, bool given in phpbb/includes/diff/diff.php:172 
      

       

      The test in is_empty assumes $edit->orig and $edit->final are always arrays, but they're booleans in some cases:

       

      class diff_op_delete extends diff_op
      {
      	function __construct($lines)
      	{
      		$this->orig = $lines;
      		$this->final = false;
      	}
       
       
      	function &reverse()
      	{
      		$reverse = new diff_op_add($this->orig);
      		return $reverse;
      	}
      }
       
      class diff_op_add extends diff_op
      {
      	function __construct($lines)
      	{
      		$this->final = $lines;
      		$this->orig = false;
      	}
       
       
      	function &reverse()
      	{
      		$reverse = new diff_op_delete($this->final);
      		return $reverse;
      	}
      }
       
       
      

       I'm not familiar with this code, but a workaround might be adding a test of is_array.

       

      Attachments

        Activity

          People

            Marc Marc
            HB HB
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: