php-src/Zend/tests/recursive_array_comparison.phpt
Ilija Tovilo 82479e89d0
Throw error for recursive comparison, instead of fatal (#14989)
I don't understand the rationale of fatal erroring here. It seems this should
properly unprotect the compared elements when returning up the stack.

Related to GH-14980
2024-07-22 15:53:41 +02:00

21 lines
391 B
PHP

--TEST--
Comparison of a recursive array throws a catchable error
--FILE--
<?php
$a = [&$a];
try {
$a === [[]];
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
[[]] === $a;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump($a === $a);
?>
--EXPECT--
Nesting level too deep - recursive dependency?
Nesting level too deep - recursive dependency?
bool(true)