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
serialize() called from a destructor during var_hash destruction reuses the outer var_hash (wrong back references, use-after-free) #24373
serialize() is not reentrant while php_var_serialize_destroy() tears down its var_hash. If a destructor runs at that moment (an object kept alive only by the var_hash, or a garbage cycle collected by a GC run triggered by the release) and calls serialize() itself, the nested call reuses the outer var_hash:
back references of the nested result continue the outer numbering and are wrong;
if the nested call grows the table, the outer destroy continues on freed memory and segfaults.
This is very likely the root cause of #20539 (closed for lack of a reproducer). We hit it in a PHPUnit functional suite (TYPO3 testing framework): serialize() of a package cache releases enough objects to trigger the GC, which collects an old DI container whose destructor writes a cache entry via serialize().
Activity
Fix phpGH-24373: serialize() context reused by destructors during tea…
Merge branch 'PHP-8.4' into PHP-8.5
Merge branch 'PHP-8.5' into PHP-8.6
Merge branch 'PHP-8.6'