dmitry          Wed Aug 10 03:43:16 2005 EDT

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/standard       array.c 
    /php-src/ext/standard/tests/array   bug29253.phpt 
  Log:
  Fixed bug #29253 (array_diff with $GLOBALS argument fails)
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.2032&r2=1.2033&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2032 php-src/NEWS:1.2033
--- php-src/NEWS:1.2032 Wed Aug 10 02:37:26 2005
+++ php-src/NEWS        Wed Aug 10 03:43:14 2005
@@ -49,6 +49,7 @@
 - Fixed bug #32139 (SOAP client does not auto-handle base64 encoding). (Ilia)
 - Fixed bug #32010 (Memory leak in mssql_fetch_batch). (fmk)
 - Fixed bug #29334 (win32 mail() provides incorrect Date: header). (Jani)
+- Fixed bug #29253 (array_diff with $GLOBALS argument fails). (Dmitry)
 
 14 Jul 2005, PHP 5.1 Beta 3
 - Upgraded bundled SQLite library for PDO:SQLite to 3.2.2 (Ilia)
http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.308&r2=1.309&ty=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308 php-src/ext/standard/array.c:1.309
--- php-src/ext/standard/array.c:1.308  Thu Aug  4 06:34:38 2005
+++ php-src/ext/standard/array.c        Wed Aug 10 03:43:15 2005
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: array.c,v 1.308 2005/08/04 10:34:38 dmitry Exp $ */
+/* $Id: array.c,v 1.309 2005/08/10 07:43:15 dmitry Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -3044,6 +3044,15 @@
 
        /* copy the argument array */
        RETVAL_ZVAL(*args[0], 1, 0);
+       if (return_value->value.ht == &EG(symbol_table)) {
+               HashTable *ht;
+               zval *tmp;
+
+               ALLOC_HASHTABLE_REL(ht);
+               zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0);
+               zend_hash_copy(ht, return_value->value.ht, (copy_ctor_func_t) 
zval_add_ref, (void *) &tmp, sizeof(zval *));
+               return_value->value.ht = ht;            
+       }
 
        if ((behavior & INTERSECT_NORMAL) && data_compare_type == 
INTERSECT_COMP_DATA_USER) {
                /* array_uintersect() */
@@ -3420,6 +3429,15 @@
 
        /* copy the argument array */
        RETVAL_ZVAL(*args[0], 1, 0);
+       if (return_value->value.ht == &EG(symbol_table)) {
+               HashTable *ht;
+               zval *tmp;
+
+               ALLOC_HASHTABLE_REL(ht);
+               zend_hash_init(ht, 0, NULL, ZVAL_PTR_DTOR, 0);
+               zend_hash_copy(ht, return_value->value.ht, (copy_ctor_func_t) 
zval_add_ref, (void *) &tmp, sizeof(zval *));
+               return_value->value.ht = ht;            
+       }
 
        if (behavior == DIFF_NORMAL && data_compare_type == 
DIFF_COMP_DATA_USER) {
                /* array_udiff() */
http://cvs.php.net/diff.php/php-src/ext/standard/tests/array/bug29253.phpt?r1=1.1&r2=1.2&ty=u
Index: php-src/ext/standard/tests/array/bug29253.phpt
diff -u /dev/null php-src/ext/standard/tests/array/bug29253.phpt:1.2
--- /dev/null   Wed Aug 10 03:43:16 2005
+++ php-src/ext/standard/tests/array/bug29253.phpt      Wed Aug 10 03:43:16 2005
@@ -0,0 +1,13 @@
+--TEST--
+Bug #29253 array_diff with $GLOBALS argument fails 
+--FILE--
+<?php
+$zz = $GLOBALS;
+$gg = 'afad';
+var_dump(array_diff_assoc($GLOBALS, $zz));
+var_dump($gg);
+?>
+--EXPECT--
+array(0) {
+}
+string(4) "afad"

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

Reply via email to