iliaa Wed Aug 25 20:26:22 2004 EDT Modified files: (Branch: PHP_5_0) /php-src NEWS /php-src/ext/standard array.c Log: MFH: Fixed bug #29808 (array_count_values() breaks with numeric strings). http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1760.2.57&r2=1.1760.2.58&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1760.2.57 php-src/NEWS:1.1760.2.58 --- php-src/NEWS:1.1760.2.57 Wed Aug 25 03:20:30 2004 +++ php-src/NEWS Wed Aug 25 20:26:21 2004 @@ -11,6 +11,7 @@ - Fixed a file-descriptor leak with phpinfo() and other 'special' URLs (Zeev) - Fixed bug #29821 (Fixed possible crashes in convert_uudecode() on invalid data). (Ilia) +- Fixed bug #29808 (array_count_values() breaks with numeric strings). (Ilia) - Fixed bug #29737 (ip2long should return -1 if IP is 255.255.255.255 and FALSE on error). (Tony) - Fixed bug #29711 (Changed ext/xml to default to UTF-8 output). (Rob) http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.266.2.2&r2=1.266.2.3&ty=u Index: php-src/ext/standard/array.c diff -u php-src/ext/standard/array.c:1.266.2.2 php-src/ext/standard/array.c:1.266.2.3 --- php-src/ext/standard/array.c:1.266.2.2 Tue Aug 10 02:01:20 2004 +++ php-src/ext/standard/array.c Wed Aug 25 20:26:22 2004 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: array.c,v 1.266.2.2 2004/08/10 06:01:20 moriyoshi Exp $ */ +/* $Id: array.c,v 1.266.2.3 2004/08/26 00:26:22 iliaa Exp $ */ #include "php.h" #include "php_ini.h" @@ -2413,6 +2413,7 @@ zend_hash_internal_pointer_reset_ex(myht, &pos); while (zend_hash_get_current_data_ex(myht, (void **)&entry, &pos) == SUCCESS) { if (Z_TYPE_PP(entry) == IS_LONG) { +int_key: if (zend_hash_index_find(Z_ARRVAL_P(return_value), Z_LVAL_PP(entry), (void**)&tmp) == FAILURE) { @@ -2425,6 +2426,13 @@ Z_LVAL_PP(tmp)++; } } else if (Z_TYPE_PP(entry) == IS_STRING) { + /* make sure our array does not end up with numeric string keys */ + if (is_numeric_string(Z_STRVAL_PP(entry), Z_STRLEN_PP(entry), NULL, NULL, 0) == IS_LONG) { + SEPARATE_ZVAL(entry); + convert_to_long_ex(entry); + goto int_key; + } + if (zend_hash_find(Z_ARRVAL_P(return_value), Z_STRVAL_PP(entry), Z_STRLEN_PP(entry)+1, (void**)&tmp) == FAILURE) { zval *data; MAKE_STD_ZVAL(data);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php