cvs: php-src /ext/standard array.c
| From: | Antony Dovgal | Date: | Tue, 04 Oct 2005 20:47:50 +0000 |
| Subject: | cvs: php-src /ext/standard array.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-34293@lists.php.net to get a copy of this message | ||
tony2001 Tue Oct 4 16:47:50 2005 EDT
Modified files:
/php-src/ext/standard array.c
Log:
fix #34723 (array_count_values() strips leading zeroes)
http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.326&r2=1.327&ty=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.326 php-src/ext/standard/array.c:1.327
--- php-src/ext/standard/array.c:1.326 Mon Oct 3 10:01:36 2005
+++ php-src/ext/standard/array.c Tue Oct 4 16:47:48 2005
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: array.c,v 1.326 2005/10/03 14:01:36 iliaa Exp $ */
+/* $Id: array.c,v 1.327 2005/10/04 20:47:48 tony2001 Exp $ */
#include "php.h"
#include "php_ini.h"
@@ -2726,9 +2726,10 @@
} else if (Z_TYPE_PP(entry) == IS_STRING ||
Z_TYPE_PP(entry) == IS_BINARY ||
Z_TYPE_PP(entry) == IS_UNICODE) {
- /* make sure our array does not end up with numeric string keys */
- if ((Z_TYPE_PP(entry) == IS_STRING && is_numeric_string(Z_STRVAL_PP(entry),
Z_STRLEN_PP(entry), NULL, NULL, 0) == IS_LONG) ||
- (Z_TYPE_PP(entry) == IS_UNICODE && is_numeric_unicode(Z_USTRVAL_PP(entry),
Z_USTRLEN_PP(entry), NULL, NULL, 0) == IS_LONG)) {
+ /* make sure our array does not end up with numeric string keys
+ * but don't touch those strings that start with 0 */
+ if ((Z_TYPE_PP(entry) == IS_STRING && !(Z_STRLEN_PP(entry) > 1 &&
Z_STRVAL_PP(entry)[0] == '0') && is_numeric_string(Z_STRVAL_PP(entry),
Z_STRLEN_PP(entry), NULL, NULL, 0) == IS_LONG) ||
+ (Z_TYPE_PP(entry) == IS_UNICODE && zend_cmp_unicode_and_literal(Z_USTRVAL_PP(entry),
1, "0", sizeof("0")-1) && is_numeric_unicode(Z_USTRVAL_PP(entry),
Z_USTRLEN_PP(entry), NULL, NULL, 0) == IS_LONG)) {
zval tmp_entry;
tmp_entry = **entry;