File tree 3 files changed +24
-2
lines changed
3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,10 @@ PHP NEWS
69
69
. Fixed bug GH-15833 (Segmentation fault (access null pointer) in
70
70
ext/spl/spl_array.c). (nielsdos)
71
71
72
+ - Standard:
73
+ . Fixed bug GH-17447 (Assertion failure when array popping a self addressing
74
+ variable). (nielsdos)
75
+
72
76
- Windows:
73
77
. Fixed clang compiler detection. (cmb)
74
78
Original file line number Diff line number Diff line change @@ -3564,7 +3564,8 @@ PHP_FUNCTION(array_pop)
3564
3564
break ;
3565
3565
}
3566
3566
}
3567
- RETVAL_COPY_DEREF (val );
3567
+ RETVAL_COPY_VALUE (val );
3568
+ ZVAL_UNDEF (val );
3568
3569
3569
3570
if (idx == (Z_ARRVAL_P (stack )-> nNextFreeElement - 1 )) {
3570
3571
Z_ARRVAL_P (stack )-> nNextFreeElement = Z_ARRVAL_P (stack )-> nNextFreeElement - 1 ;
@@ -3588,7 +3589,8 @@ PHP_FUNCTION(array_pop)
3588
3589
break ;
3589
3590
}
3590
3591
}
3591
- RETVAL_COPY_DEREF (val );
3592
+ RETVAL_COPY_VALUE (val );
3593
+ ZVAL_UNDEF (val );
3592
3594
3593
3595
if (!p -> key && (zend_long )p -> h == (Z_ARRVAL_P (stack )-> nNextFreeElement - 1 )) {
3594
3596
Z_ARRVAL_P (stack )-> nNextFreeElement = Z_ARRVAL_P (stack )-> nNextFreeElement - 1 ;
@@ -3598,6 +3600,10 @@ PHP_FUNCTION(array_pop)
3598
3600
zend_hash_del_bucket (Z_ARRVAL_P (stack ), p );
3599
3601
}
3600
3602
zend_hash_internal_pointer_reset (Z_ARRVAL_P (stack ));
3603
+
3604
+ if (Z_ISREF_P (return_value )) {
3605
+ zend_unwrap_reference (return_value );
3606
+ }
3601
3607
}
3602
3608
/* }}} */
3603
3609
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-17447 (Assertion failure when array poping a self addressing variable)
3
+ --FILE--
4
+ <?php
5
+ $ input [] = &$ input ;
6
+ var_dump (array_pop ($ input ), $ input );
7
+ ?>
8
+ --EXPECT--
9
+ array(0) {
10
+ }
11
+ array(0) {
12
+ }
You can’t perform that action at this time.
0 commit comments