php-diff icon indicating copy to clipboard operation
php-diff copied to clipboard

Error when not checking the count argument is an array

Open nasri-lab opened this issue 1 year ago • 0 comments

PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /Diff/SequenceMatcher.php:353

$aLength = count($this->a); $bLength = count($this->b);

Please fix by replacing with this :

$aLength = is_array($this->a) ? count($this->a) : 0; $bLength = is_array($this->b) ? count($this->b) : 0;

nasri-lab avatar Aug 12 '23 12:08 nasri-lab