cvs: php-src(PHP_4_4) /ext/standard array.c

From: Date: Mon, 22 Jan 2007 08:23:08 +0000
Subject: cvs: php-src(PHP_4_4) /ext/standard array.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-42847@lists.php.net to get a copy of this message
tony2001 Mon Jan 22 08:23:08 2007 UTC Modified files: (Branch: PHP_4_4) /php-src/ext/standard array.c Log: fix array_unique() to return array with any type of argument http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.199.2.44.2.14&r2=1.199.2.44.2.15&diff_format=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.199.2.44.2.14 php-src/ext/standard/array.c:1.199.2.44.2.15 --- php-src/ext/standard/array.c:1.199.2.44.2.14 Mon Jan 1 09:46:47 2007 +++ php-src/ext/standard/array.c Mon Jan 22 08:23:08 2007 @@ -22,7 +22,7 @@ */ -/* $Id: array.c,v 1.199.2.44.2.14 2007/01/01 09:46:47 sebastian Exp $ */ +/* $Id: array.c,v 1.199.2.44.2.15 2007/01/22 08:23:08 tony2001 Exp $ */ #include "php.h" #include "php_ini.h" @@ -2515,7 +2515,7 @@ Removes duplicate values from array */ PHP_FUNCTION(array_unique) { - zval **array; + zval **array, *tmp; HashTable *target_hash; Bucket *p; struct bucketindex { @@ -2534,9 +2534,8 @@ RETURN_FALSE; } - /* copy the argument array */ - *return_value = **array; - zval_copy_ctor(return_value); + array_init(return_value); + zend_hash_copy(Z_ARRVAL_P(return_value), target_hash, (copy_ctor_func_t) zval_add_ref, (void *)&tmp, sizeof(zval*)); if (target_hash->nNumOfElements <= 1) /* nothing to do */ return;

« previous php.cvs (#42847) next »