Skip to content

Commit c77bbcd

Browse files
committed
Fixed GH-8041 (php 8.2.0-dev crashes with assertion for cloning/get_object_vars on non-empty SplFixedArray)
1 parent a04d181 commit c77bbcd

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

ext/spl/spl_fixedarray.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ static HashTable* spl_fixedarray_object_get_properties(zend_object *obj)
223223
zend_hash_index_del(ht, i);
224224
}
225225
}
226+
if (HT_IS_PACKED(ht)) {
227+
/* Engine doesn't expet packed array */
228+
zend_hash_packed_to_hash(ht);
229+
}
226230
}
227231

228232
return ht;

ext/spl/tests/fixedarray_023.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
SPL: FixedArray: Bug GH-8041 (php 8.2.0-dev crashes with assertion for cloning/get_object_vars on non-empty SplFixedArray)
3+
--FILE--
4+
<?php
5+
$x = new SplFixedArray(1);
6+
$z = (array)$x;
7+
$y = clone $x;
8+
?>
9+
DONE
10+
--EXPECT--
11+
DONE

0 commit comments

Comments
 (0)