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 @@ -54,6 +54,10 @@ PHP NEWS
5454 . Fixed ZPP type violation in phpdbg_get_executable() and phpdbg_end_oplog().
5555 (Girgias)
5656
57+ - SPL:
58+ . Fixed bug GH-20614 (SplFixedArray incorrectly handles references
59+ in deserialization). (ndossche)
60+
5761- Standard:
5862 . Fix memory leak in array_diff() with custom type checks. (ndossche)
5963 . Fixed bug GH-20583 (Stack overflow in http_build_query
Original file line number Diff line number Diff line change @@ -639,7 +639,7 @@ PHP_METHOD(SplFixedArray, __unserialize)
639639 intern -> array .size = 0 ;
640640 ZEND_HASH_FOREACH_STR_KEY_VAL (data , key , elem ) {
641641 if (key == NULL ) {
642- ZVAL_COPY (& intern -> array .elements [intern -> array .size ], elem );
642+ ZVAL_COPY_DEREF (& intern -> array .elements [intern -> array .size ], elem );
643643 intern -> array .size ++ ;
644644 } else {
645645 Z_TRY_ADDREF_P (elem );
@@ -832,7 +832,7 @@ PHP_METHOD(SplFixedArray, offsetGet)
832832 value = spl_fixedarray_object_read_dimension_helper (intern , zindex );
833833
834834 if (value ) {
835- RETURN_COPY_DEREF (value );
835+ RETURN_COPY (value );
836836 } else {
837837 RETURN_NULL ();
838838 }
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