Not related to this bug but can you PLEASE run 'make test'
    after each and every fix you make? Especially when you touch
    engine stuff..

    Now these tests have started to fail:

    tests/lang/013.phpt
    tests/lang/014.phpt
    tests/lang/018.phpt

    All eval() related..

    --Jani


On Mon, 4 Jul 2005, Dmitry Stogov wrote:

dmitry          Mon Jul  4 06:00:39 2005 EDT

 Added files:
   /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.1977&r2=1.1978&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1977 php-src/NEWS:1.1978
--- php-src/NEWS:1.1977 Mon Jul  4 03:48:16 2005
+++ php-src/NEWS        Mon Jul  4 06:00:34 2005
@@ -20,6 +20,7 @@
  overloaded (__get)). (Dmitry)
- Fixed bug #31358 (Older GCC versions do not provide portable va_copy()).
  (Jani)
+- Fixed bug #31158 (array_splice on $GLOBALS crashes). (Dmitry)
- Fixed bug #30828 (debug_backtrace() reports incorrect class in overridden
  methods). (Dmitry)
- Fixed bug #30519 (Interface not existing says Class not found). (Dmitry)
http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.305&r2=1.306&ty=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.305 php-src/ext/standard/array.c:1.306
--- php-src/ext/standard/array.c:1.305  Thu Jun 30 07:15:00 2005
+++ php-src/ext/standard/array.c        Mon Jul  4 06:00:38 2005
@@ -21,7 +21,7 @@
   +----------------------------------------------------------------------+
*/

-/* $Id: array.c,v 1.305 2005/06/30 11:15:00 sniper Exp $ */
+/* $Id: array.c,v 1.306 2005/07/04 10:00:38 dmitry Exp $ */

#include "php.h"
#include "php_ini.h"
@@ -2060,8 +2060,11 @@
           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));
-       FREE_HASHTABLE(Z_ARRVAL_P(stack));
-       Z_ARRVAL_P(stack) = new_hash;
+       if (Z_ARRVAL_P(stack) == &EG(symbol_table)) {
+               zend_reset_all_cv(&EG(symbol_table) TSRMLS_CC);
+       }
+       *Z_ARRVAL_P(stack) = *new_hash;
+       FREE_HASHTABLE(new_hash);

        /* Clean up and return the number of elements in the stack */
        efree(args);
@@ -2137,8 +2140,11 @@

        /* 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;
+       if (Z_ARRVAL_P(array) == &EG(symbol_table)) {
+               zend_reset_all_cv(&EG(symbol_table) TSRMLS_CC);
+       }
+       *Z_ARRVAL_P(array) = *new_hash;
+       FREE_HASHTABLE(new_hash);

        /* Clean up */
        if (argc == 4)
@@ -2670,8 +2676,11 @@

        /* 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;
+       if (Z_ARRVAL_P(return_value) == &EG(symbol_table)) {
+               zend_reset_all_cv(&EG(symbol_table) TSRMLS_CC);
+       }
+       *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



--
Donate @ http://pecl.php.net/wishlist.php/sniper

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to