From c77bbcd4642a982fd9fdaf32dbe444d925c7883f Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Fri, 11 Feb 2022 16:46:12 +0300 Subject: [PATCH] Fixed GH-8041 (php 8.2.0-dev crashes with assertion for cloning/get_object_vars on non-empty SplFixedArray) --- ext/spl/spl_fixedarray.c | 4 ++++ ext/spl/tests/fixedarray_023.phpt | 11 +++++++++++ 2 files changed, 15 insertions(+) create mode 100644 ext/spl/tests/fixedarray_023.phpt diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 8901c95694f..7bfc8413fb2 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -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; diff --git a/ext/spl/tests/fixedarray_023.phpt b/ext/spl/tests/fixedarray_023.phpt new file mode 100644 index 00000000000..e0e2606c90a --- /dev/null +++ b/ext/spl/tests/fixedarray_023.phpt @@ -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-- + +DONE +--EXPECT-- +DONE