]> granicus.if.org Git - php/commitdiff
MFH: fix #34723 (array_count_values() strips leading zeroes)
authorAntony Dovgal <tony2001@php.net>
Tue, 4 Oct 2005 20:48:17 +0000 (20:48 +0000)
committerAntony Dovgal <tony2001@php.net>
Tue, 4 Oct 2005 20:48:17 +0000 (20:48 +0000)
NEWS
ext/standard/array.c

diff --git a/NEWS b/NEWS
index 48f9cb9c7116f3317400cac081b9b6c978378f20..5671b4c4355389caa123472475c20bd3f1d6a50a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -40,6 +40,7 @@ PHP                                                                        NEWS
 - Fixed "make test" to work for phpized extensions. (Hartmut, Jani)
 - Fixed failing queries (FALSE returned) with mysqli_query() on 64 bit systems.
   (Andrey)
+- Fixed bug #34723 (array_count_values() strips leading zeroes). (Tony)
 - Fixed bug #34678 (__call(), is_callable() and static methods). (Dmitry)
 - Fixed bug #34645 (ctype corrupts memory when validating large numbers). (Ilia)
 - Fixed bug #34643 (wsdl default value has no effect). (Dmitry)
index 9c8058785082ed2b2c70a701e80a861ce117d1a9..fd9f2af36facbadce2e06daf9377f5afd615e725 100644 (file)
@@ -2520,8 +2520,9 @@ PHP_FUNCTION(array_count_values)
                                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) {
+                       /* make sure our array does not end up with numeric string keys
+                        * but don't touch those strings that start with 0 */
+                       if (!(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) {
                                zval tmp_entry;
                                
                                tmp_entry = **entry;