ID: 43614 User updated by: dmitriy dot buldakov at toatech dot com Reported By: dmitriy dot buldakov at toatech dot com Status: Open Bug Type: Arrays related Operating System: Mac OS X PHP Version: 5.2.5 New Comment:
I have not tesdet last patch yet, but looks like "0" is not converted to int 0 with the patch. Previous Comments: ------------------------------------------------------------------------ [2007-12-18 12:04:46] dmitriy dot buldakov at toatech dot com I have not tesdet last patch yet, but looks like "0" is not converted to int 0 with the patch. ------------------------------------------------------------------------ [2007-12-18 01:52:38] [EMAIL PROTECTED] Updated. The function did accept other characters. And how not is possible to use de HANDLE_NUMERIC(), I make a loop and check for each char. http://ecl.zoone.com.br/etc/patches/bug43614.patch ------------------------------------------------------------------------ [2007-12-17 16:03:08] dmitriy dot buldakov at toatech dot com Last patch works much more better, but there is still a problem. the patch ignores leading spaces. for example keys ' 10' and ' -10' are converted to integer 10 and -10. ------------------------------------------------------------------------ [2007-12-17 13:54:07] [EMAIL PROTECTED] Yes, correct. I've used not suitable function. Tony alerted me of a correct function. http://ecl.zoone.com.br/etc/patches/bug43614.patch http://ecl.zoone.com.br/etc/patches/bug43614.phpt ------------------------------------------------------------------------ [2007-12-17 13:38:13] dmitriy dot buldakov at toatech dot com Looks like the simple solution is not very good. As far as I understood the patch just convert any numeric string to long. It is not right way because: 1) it dose not make range check ("9999999999" is converted to 2147483647) 2) it dose not recognize negative values ("-10" is not converted to string) 3) it ignores leading zero ("01" to 1) For example, the reproduce code result is still not expected: 1 Array ( [10] => 3 [1] => 2 [01] => 4 ) KEY: int(10) VAL: int(3) KEY: int(1) VAL: int(2) KEY: string(2) "01" VAL: int(4) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/43614 -- Edit this bug report at http://bugs.php.net/?id=43614&edit=1
