Describe the bug
Up to PHP 8.0, substr used to return empty string on failure. Since PHP 8.0, it returns false. We have a function (coming in #602) which can handle both of the 2 different cases.
Currently we don't check our substr for failures at all. Eg:
$diff_txt = file_get_contents(substr($screenshot, 0, -4) . '.diff.txt');
will evaluate to:
$diff_txt = file_get_contents('false.diff.txt');
on PHP 8.0 failure and to
$diff_txt = file_get_contents('.diff.txt');
on failure on versions before 8.0.
The compatibility function forces us to check if we had a failure or not.
The error was found by PHPStan but it doesn't complain about it anymore as it thinks we want to have false.diff.txt etc.
Describe the bug
Up to PHP 8.0,
substrused to return empty string on failure. Since PHP 8.0, it returnsfalse. We have a function (coming in #602) which can handle both of the 2 different cases.Currently we don't check our substr for failures at all. Eg:
$diff_txt = file_get_contents(substr($screenshot, 0, -4) . '.diff.txt');will evaluate to:
$diff_txt = file_get_contents('false.diff.txt');on PHP 8.0 failure and to
$diff_txt = file_get_contents('.diff.txt');on failure on versions before 8.0.
The compatibility function forces us to check if we had a failure or not.
The error was found by PHPStan but it doesn't complain about it anymore as it thinks we want to have
false.diff.txtetc.