File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,12 @@ static HashTable* spl_fixedarray_object_get_properties(zend_object *obj)
207
207
if (!spl_fixedarray_empty (& intern -> array )) {
208
208
zend_long j = zend_hash_num_elements (ht );
209
209
210
+ if (GC_REFCOUNT (ht ) > 1 ) {
211
+ intern -> std .properties = zend_array_dup (ht );
212
+ if (!(GC_FLAGS (ht ) & GC_IMMUTABLE )) {
213
+ GC_DELREF (ht );
214
+ }
215
+ }
210
216
for (zend_long i = 0 ; i < intern -> array .size ; i ++ ) {
211
217
zend_hash_index_update (ht , i , & intern -> array .elements [i ]);
212
218
Z_TRY_ADDREF (intern -> array .elements [i ]);
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ SPL: FixedArray: Bug GH-8044 (var_export/debug_zval_dump HT_ASSERT_RC1 debug failure for SplFixedArray)
3
+ --FILE--
4
+ <?php
5
+ call_user_func (function () {
6
+ $ x = new SplFixedArray (1 );
7
+ $ x [0 ] = $ x ;
8
+ var_export ($ x ); echo "\n" ;
9
+ debug_zval_dump ($ x ); echo "\n" ;
10
+ });
11
+ ?>
12
+ --EXPECTF--
13
+ Warning: var_export does not handle circular references in %s on line 5
14
+ SplFixedArray::__set_state(array(
15
+ 0 => NULL,
16
+ ))
17
+ object(SplFixedArray)#2 (1) refcount(4){
18
+ [0]=>
19
+ *RECURSION*
20
+ }
You can’t perform that action at this time.
0 commit comments