Repository navigation
Assert that destroyed hash tables are not in GC buffer - #24739
Conversation
iliaal
left a comment
There was a problem hiding this comment.
Please cover the array_splice() storage-replacement path as well.
| { | ||
| IS_CONSISTENT(ht); | ||
| HT_ASSERT(ht, GC_REFCOUNT(ht) <= 1); | ||
| ZEND_ASSERT(((GC_TYPE(ht) == IS_ARRAY && !(GC_TYPE_INFO(ht) & GC_INFO_MASK)) |
There was a problem hiding this comment.
php_splice() also calls zend_hash_destroy(in_hash) while replacing bucket storage, but keeps the GC information intact. A GC-buffered array can have refcount 1, so array_splice()'s parameter separation can leave it unchanged and this new assertion rejects a valid caller state.
Please apply the same GC_TYPE_INFO save/reset/restore used for array_unshift() around that call in php_splice(), and add regression coverage for a GC-buffered array. Keep the HashTable allocation alive; switching to zend_array_destroy() would free it.
There was a problem hiding this comment.
Thank you for spotting this. Should be fixed now.
Related: f963484
MACOS failure unrelated