[php-src] PR #25568: Fix GH-25567: GC segfault on array with nNumUsed > 0 and NULL arData

From: Date: Wed, 18 Nov 2026 21:26:10 +0000
Subject: [php-src] PR #25568: Fix GH-25567: GC segfault on array with nNumUsed > 0 and NULL arData
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-40789@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25568 Author: zonuexe ## Summary Fixes GH-25567. gc_mark_grey() segfaults when a GC root is an array whose header is still live (IS_ARRAY, a root index, non-zero refcount) but nNumUsed > 0 and arData is NULL. The same shape is walked again by gc_scan_black(), gc_scan(), gc_collect_white(), and gc_remove_nested_data_from_buffer(). gc_array_num_used() treats that table as empty so those walks do not dereference the data pointer. arPacked is the same union member, so the packed path is covered too. This is not asserted. In non-debug builds ZEND_ASSERT becomes ZEND_ASSUME, and the optimizer would delete the guard. There is no userland reproducer. The crash was a NULL dereference in a long-running PHP 8.6.0RC7 CLI process after the root buffer had grown to 120000 entries. A fresh process running the same test does not crash. OPcache was off. ## Test plan - [x] Zend/zend_gc.c builds with --enable-debug (make Zend/zend_gc.lo) - [ ] No phpt: the corrupt HashTable cannot be built from userland - [ ] make test not run (no small case to add) Made with [Cursor](https://cursor.com)

« previous php.git-pulls (#40789) next »