Edit report at http://bugs.php.net/bug.php?id=53301&edit=1
ID: 53301 Comment by: rbysa at yahoo dot com Reported by: rbysa at yahoo dot com Summary: http_build_query unexpected behavior Status: Bogus Type: Bug Package: *General Issues Operating System: Ubuntu PHP Version: 5.3.3 Block user comment: N Private report: N New Comment: PHP Version 5.2.4-2ubuntu5.10 Here is another test case $test = array('123456789012345=>'9780553', 1=>12312312312); print_r($test) //This line looks correct echo http_build_query($test) //This line does not Here is the output Array ( [123456789012345] => 9780553 [1] => 12312312312 ) 123456789012=9780553&1=12312312312 Previous Comments: ------------------------------------------------------------------------ [2010-12-12 18:45:23] il...@php.net Cannot reproduce the issue either. ------------------------------------------------------------------------ [2010-11-12 22:41:19] fel...@php.net I got the expected result... Array ( [1234567890123] => foo ) ------------------------------------------------------------------------ [2010-11-12 22:38:08] rbysa at yahoo dot com Your example does not represent the problem. In my haste I messed up my own example code but here it is again. $var = "1234567890123"; $varArray = array(); $varArray[$var]= "foo"; $build = http_build_query($varArray); $result = array(); parse_str($build, $result); print_r($result); //Expect Array( "1234567890123"=>"foo") //Actual Array( "123456789012" =>"foo") ------------------------------------------------------------------------ [2010-11-12 22:00:14] fel...@php.net You need to use: $var = array('12345678901' => 'foo'); var_dump(http_build_query($var)); As said in the other bug report. ------------------------------------------------------------------------ [2010-11-12 20:34:25] rbysa at yahoo dot com Also I do want to mention that I saw the previous bug report on this issue http://bugs.php.net/bug.php?id=49023 However this bug report has been labeled "bogus" even though the documentation does not support the mentioned behavior. ------------------------------------------------------------------------ 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/bug.php?id=53301 -- Edit this bug report at http://bugs.php.net/bug.php?id=53301&edit=1