php-diff
php-diff copied to clipboard
Error when not checking the count argument is an array
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;