File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -69,6 +69,10 @@ PHP NEWS
6969 . Fixed bug GH-15833 (Segmentation fault (access null pointer) in
7070 ext/spl/spl_array.c). (nielsdos)
7171
72+ - Standard:
73+ . Fixed bug GH-17447 (Assertion failure when array popping a self addressing
74+ variable). (nielsdos)
75+
7276- Windows:
7377 . Fixed clang compiler detection. (cmb)
7478
Original file line number Diff line number Diff line change @@ -3564,7 +3564,8 @@ PHP_FUNCTION(array_pop)
35643564 break ;
35653565 }
35663566 }
3567- RETVAL_COPY_DEREF (val );
3567+ RETVAL_COPY_VALUE (val );
3568+ ZVAL_UNDEF (val );
35683569
35693570 if (idx == (Z_ARRVAL_P (stack )-> nNextFreeElement - 1 )) {
35703571 Z_ARRVAL_P (stack )-> nNextFreeElement = Z_ARRVAL_P (stack )-> nNextFreeElement - 1 ;
@@ -3588,7 +3589,8 @@ PHP_FUNCTION(array_pop)
35883589 break ;
35893590 }
35903591 }
3591- RETVAL_COPY_DEREF (val );
3592+ RETVAL_COPY_VALUE (val );
3593+ ZVAL_UNDEF (val );
35923594
35933595 if (!p -> key && (zend_long )p -> h == (Z_ARRVAL_P (stack )-> nNextFreeElement - 1 )) {
35943596 Z_ARRVAL_P (stack )-> nNextFreeElement = Z_ARRVAL_P (stack )-> nNextFreeElement - 1 ;
@@ -3598,6 +3600,10 @@ PHP_FUNCTION(array_pop)
35983600 zend_hash_del_bucket (Z_ARRVAL_P (stack ), p );
35993601 }
36003602 zend_hash_internal_pointer_reset (Z_ARRVAL_P (stack ));
3603+
3604+ if (Z_ISREF_P (return_value )) {
3605+ zend_unwrap_reference (return_value );
3606+ }
36013607}
36023608/* }}} */
36033609
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