Commit 282be4eceb1 for php.net
commit 282be4eceb160b3be2be25b74ebc0b7664a17f27
Merge: 28e41a9c475 8723e6606a5
Author: David Carlier <devnexen@gmail.com>
Date: Wed Sep 23 20:06:44 2026 +0100
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
Fix GH-23811: SplFixedArray leak on re-init and broken setSize()
diff --cc ext/spl/spl_fixedarray.c
index 6effe9adc30,18025e0cbeb..61f6da4cff2
--- a/ext/spl/spl_fixedarray.c
+++ b/ext/spl/spl_fixedarray.c
@@@ -287,12 -297,26 +299,15 @@@ static zend_object *spl_fixedarray_obje
if (orig && clone_orig) {
spl_fixedarray_object *other = spl_fixed_array_from_obj(orig);
spl_fixedarray_copy_ctor(&intern->array, &other->array);
+ } else {
+ /* The zeroed struct would mean "resizing"; set the sentinel. */
+ spl_fixedarray_default_ctor(&intern->array);
}
- while (parent) {
- if (parent == spl_ce_SplFixedArray) {
- break;
- }
-
- parent = parent->parent;
- inherited = true;
- }
-
- ZEND_ASSERT(parent);
-
- if (UNEXPECTED(inherited)) {
+ if (UNEXPECTED(class_type != spl_ce_SplFixedArray)) {
/* Find count() method */
zend_function *fptr_count = zend_hash_find_ptr(&class_type->function_table, ZSTR_KNOWN(ZEND_STR_COUNT));
- if (fptr_count->common.scope == parent) {
+ if (fptr_count->common.scope == spl_ce_SplFixedArray) {
fptr_count = NULL;
}
intern->fptr_count = fptr_count;