cvs: php-src(PHP_5_0) / NEWS /ext/standard array.c /ext/standard/tests/array bug31158.phpt

From: Date: Mon, 04 Jul 2005 10:08:22 +0000
Subject: cvs: php-src(PHP_5_0) / NEWS /ext/standard array.c /ext/standard/tests/array bug31158.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-32671@lists.php.net to get a copy of this message
dmitry Mon Jul 4 06:08:22 2005 EDT Added files: (Branch: PHP_5_0) /php-src/ext/standard/tests/array bug31158.phpt Modified files: /php-src NEWS /php-src/ext/standard array.c Log: Fixed bug #31158 (array_splice on $GLOBALS crashes) http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1760.2.446&r2=1.1760.2.447&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1760.2.446 php-src/NEWS:1.1760.2.447 --- php-src/NEWS:1.1760.2.446 Tue Jun 28 13:07:26 2005 +++ php-src/NEWS Mon Jul 4 06:08:19 2005 @@ -136,6 +136,7 @@ - Fixed bug #31465 (False warning in unpack() when working with *). (Ilia) - Fixed bug #31363 (broken non-blocking flock()). ian at snork dot net - Fixed bug #31213 (Sideeffects caused by fix of bug #29493). (Dmitry) +- Fixed bug #31158 (array_splice on $GLOBALS crashes). (Dmitry) - Fixed bug #30961 (Wrong linenumber in ReflectionClass getStartLine()). (Dmitry) - Fixed bug #30889 (Conflict between __get/__set and ++ operator). (Dmitry) http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.266.2.19&r2=1.266.2.20&ty=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.266.2.19 php-src/ext/standard/array.c:1.266.2.20 --- php-src/ext/standard/array.c:1.266.2.19 Tue Jun 21 08:10:59 2005 +++ php-src/ext/standard/array.c Mon Jul 4 06:08:21 2005 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.266.2.19 2005/06/21 12:10:59 dmitry Exp $ */ +/* $Id: array.c,v 1.266.2.20 2005/07/04 10:08:21 dmitry Exp $ */ #include "php.h" #include "php_ini.h" @@ -2009,8 +2009,8 @@ hashtable and replace it with new one */ new_hash = php_splice(Z_ARRVAL_P(stack), 0, 0, &args[1], argc-1, NULL); zend_hash_destroy(Z_ARRVAL_P(stack)); - efree(Z_ARRVAL_P(stack)); - Z_ARRVAL_P(stack) = new_hash; + *Z_ARRVAL_P(stack) = *new_hash; + FREE_HASHTABLE(new_hash); /* Clean up and return the number of elements in the stack */ efree(args); @@ -2086,8 +2086,8 @@ /* Replace input array's hashtable with the new one */ zend_hash_destroy(Z_ARRVAL_P(array)); - efree(Z_ARRVAL_P(array)); - Z_ARRVAL_P(array) = new_hash; + *Z_ARRVAL_P(array) = *new_hash; + FREE_HASHTABLE(new_hash); /* Clean up */ if (argc == 4) @@ -2620,8 +2620,8 @@ /* Copy the result hash into return value */ zend_hash_destroy(Z_ARRVAL_P(return_value)); - efree(Z_ARRVAL_P(return_value)); - Z_ARRVAL_P(return_value) = new_hash; + *Z_ARRVAL_P(return_value) = *new_hash; + FREE_HASHTABLE(new_hash); /* Clean up */ efree(pads); http://cvs.php.net/co.php/php-src/ext/standard/tests/array/bug31158.phpt?r=1.1&p=1 Index: php-src/ext/standard/tests/array/bug31158.phpt +++ php-src/ext/standard/tests/array/bug31158.phpt --TEST-- Bug #31158 (array_splice on $GLOBALS crashes) --FILE-- <?php function __(){ $GLOBALS['a'] = "bug\n"; array_splice($GLOBALS,0,count($GLOBALS)); /* All global variables including $GLOBALS are removed */ echo $GLOBALS['a']; } __(); echo "ok\n"; ?> --EXPECTF-- Notice: Undefined variable: GLOBALS in %sbug31158.php on line 6 ok

« previous php.cvs (#32671) next »