Fixed GH-8041 (php 8.2.0-dev crashes with assertion for cloning/get_object_vars on non-empty SplFixedArray)

This commit is contained in:
Dmitry Stogov 2022-02-11 16:46:12 +03:00
parent a04d181578
commit c77bbcd464
2 changed files with 15 additions and 0 deletions

View file

@ -223,6 +223,10 @@ static HashTable* spl_fixedarray_object_get_properties(zend_object *obj)
zend_hash_index_del(ht, i);
}
}
if (HT_IS_PACKED(ht)) {
/* Engine doesn't expet packed array */
zend_hash_packed_to_hash(ht);
}
}
return ht;

View file

@ -0,0 +1,11 @@
--TEST--
SPL: FixedArray: Bug GH-8041 (php 8.2.0-dev crashes with assertion for cloning/get_object_vars on non-empty SplFixedArray)
--FILE--
<?php
$x = new SplFixedArray(1);
$z = (array)$x;
$y = clone $x;
?>
DONE
--EXPECT--
DONE