File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed
Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,10 @@ PHP NEWS
6565 . Fixed ZPP type violation in phpdbg_get_executable() and phpdbg_end_oplog().
6666 (Girgias)
6767
68+ - SPL:
69+ . Fixed bug GH-20614 (SplFixedArray incorrectly handles references
70+ in deserialization). (ndossche)
71+
6872- Standard:
6973 . Fix memory leak in array_diff() with custom type checks. (ndossche)
7074 . Fixed bug GH-20583 (Stack overflow in http_build_query
Original file line number Diff line number Diff line change @@ -645,7 +645,7 @@ PHP_METHOD(SplFixedArray, __unserialize)
645645 intern -> array .size = 0 ;
646646 ZEND_HASH_FOREACH_STR_KEY_VAL (data , key , elem ) {
647647 if (key == NULL ) {
648- ZVAL_COPY (& intern -> array .elements [intern -> array .size ], elem );
648+ ZVAL_COPY_DEREF (& intern -> array .elements [intern -> array .size ], elem );
649649 intern -> array .size ++ ;
650650 } else {
651651 Z_TRY_ADDREF_P (elem );
@@ -826,7 +826,7 @@ PHP_METHOD(SplFixedArray, offsetGet)
826826 value = spl_fixedarray_object_read_dimension_helper (intern , zindex );
827827
828828 if (value ) {
829- RETURN_COPY_DEREF (value );
829+ RETURN_COPY (value );
830830 } else {
831831 RETURN_NULL ();
832832 }
Original file line number Diff line number Diff line change 1+ --TEST--
2+ GH-20614 (SplFixedArray incorrectly handles references in deserialization)
3+ --FILE--
4+ <?php
5+
6+ $ fa = new SplFixedArray (0 );
7+ $ nr = 1 ;
8+ $ array = [&$ nr ];
9+ $ fa ->__unserialize ($ array );
10+ var_dump ($ fa );
11+ unset($ fa [0 ]);
12+ var_dump ($ fa );
13+
14+ ?>
15+ --EXPECT--
16+ object(SplFixedArray)#1 (1) {
17+ [0]=>
18+ int(1)
19+ }
20+ object(SplFixedArray)#1 (1) {
21+ [0]=>
22+ NULL
23+ }
You can’t perform that action at this time.
0 commit comments