Bug #53301 [Bgs]: http_build_query unexpected behavior

From: Date: Sat, 25 Dec 2010 19:52:30 +0000
Subject: Bug #53301 [Bgs]: http_build_query unexpected behavior
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-157319@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53301&edit=1 ID: 53301 User updated 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 +PHP Version: 5.2.4 Block user comment: N Private report: N New Comment: Incorrect PHP Version Previous Comments: ------------------------------------------------------------------------ [2010-12-25 20:45:56] rbysa at yahoo dot com 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 ------------------------------------------------------------------------ [2010-12-12 18:45:23] iliaa@php.net Cannot reproduce the issue either. ------------------------------------------------------------------------ [2010-11-12 22:41:19] felipe@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] felipe@php.net You need to use: $var = array('12345678901' => 'foo'); var_dump(http_build_query($var)); As said in the other bug report. ------------------------------------------------------------------------ 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

« previous php.bugs (#157319) next »