dmitry Wed Aug 10 03:44:11 2005 EDT
Added files: (Branch: PHP_4_4)
/php-src/ext/standard/tests/array bug29253.phpt
Modified files:
/php-src NEWS
/php-src/ext/standard array.c
Log:
Fixed bug #29253 (array_diff with $GLOBALS argument fails)
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.920.2.20&r2=1.1247.2.920.2.21&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.920.2.20 php-src/NEWS:1.1247.2.920.2.21
--- php-src/NEWS:1.1247.2.920.2.20 Thu Aug 4 06:37:50 2005
+++ php-src/NEWS Wed Aug 10 03:44:07 2005
@@ -9,6 +9,7 @@
(Nuno)
- Fixed bug #32160 (copying a file into itself leads to data loss). (Ilia)
- Fixed bug #31158 (array_splice on $GLOBALS crashes). (Dmitry)
+- Fixed bug #29253 (array_diff with $GLOBALS argument fails). (Dmitry)
11 Jul 2005, Version 4.4.0
- Added man pages for "phpize" and "php-config" scripts. (Jakub Vrana)
http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.199.2.44.2.4&r2=1.199.2.44.2.5&ty=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.199.2.44.2.4
php-src/ext/standard/array.c:1.199.2.44.2.5
--- php-src/ext/standard/array.c:1.199.2.44.2.4 Thu Aug 4 06:37:51 2005
+++ php-src/ext/standard/array.c Wed Aug 10 03:44:09 2005
@@ -22,7 +22,7 @@
*/
-/* $Id: array.c,v 1.199.2.44.2.4 2005/08/04 10:37:51 dmitry Exp $ */
+/* $Id: array.c,v 1.199.2.44.2.5 2005/08/10 07:44:09 dmitry Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -2622,6 +2622,15 @@
/* copy the argument array */
*return_value = **args[0];
zval_copy_ctor(return_value);
+ if (return_value->value.ht == &EG(symbol_table)) {
+ HashTable *ht;
+ zval *tmp;
+
+ ALLOC_HASHTABLE(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;
+ }
/* go through the lists and look for common values */
while (*ptrs[0]) {
@@ -2772,6 +2781,15 @@
/* copy the argument array */
*return_value = **args[0];
zval_copy_ctor(return_value);
+ if (return_value->value.ht == &EG(symbol_table)) {
+ HashTable *ht;
+ zval *tmp;
+
+ ALLOC_HASHTABLE(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;
+ }
/* go through the lists and look for values of ptr[0]
that are not in the others */
http://cvs.php.net/co.php/php-src/ext/standard/tests/array/bug29253.phpt?r=1.1&p=1
Index: php-src/ext/standard/tests/array/bug29253.phpt
+++ php-src/ext/standard/tests/array/bug29253.phpt
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php