You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Heap check on a recursive object graph is a fatal error on PHP 8.2 and 8.3 #21
On PHP 8.2 and 8.3 a heap check over an entity with a recursive object graph kills the whole test run. HeapIntegrity::equals() compares objects with == inside try { … } catch (\Error), but before PHP 8.4 a recursive comparison is the fatal error Nesting level too deep - recursive dependency?, which no catch can intercept. The process exits with code 255 and every remaining test is lost. On PHP 8.4+ it is a catchable \Error and equals() returns false as intended.
Is this a regression?
No, the comparison has been like this since the heap check was added.
To Reproduce
PHP 8.2 or 8.3.
An ORM test whose heap holds an entity whose original and current state are two distinct instances of a self-referencing graph (e.g. a parent with a child pointing back at it).
The heap check after the test calls HeapIntegrity::equals() on them and the run dies with PHP Fatal error: Nesting level too deep - recursive dependency? in src/ORM/HeapIntegrity.php.
Expected behaviour
The heap check reports the entity as changed (or compares the graph without recursing forever), and the run goes on.
Media prove
Not applicable.
Database
All of them.
Your environment
cycle/testing 1.x, src/ORM/HeapIntegrity.php (equals()), PHP 8.2 and 8.3.
Additional context
Found while killing escaped mutants in #20; the test covering it is skipped below PHP 8.4. A fix could track visited object pairs (SplObjectStorage) and compare properties itself instead of relying on ==.
Activity