Bug #52359 [NEW]: http_build_query seem to encode array incorrectly
| From: | jj at danskscanning dot dk | Date: | Fri, 16 Jul 2010 09:25:09 +0000 |
| Subject: | Bug #52359 [NEW]: http_build_query seem to encode array incorrectly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-152474@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows XP SP3
PHP version: Irrelevant
Package: URL related
Bug Type: Bug
Bug description:http_build_query seem to encode array incorrectly
Description:
------------
I was working in VS.php with a CodeIgniter Project (5.2) and have not made
any
changes to the standard setup.
Test script:
---------------
<?php
$a = array();
$a["foo/bar"] = array();
$a["foo/bar"][] = "1";
$a["foo/bar"][] = "2";
$a["bar"] = "foo";
$b = http_build_query($a, NULL, "&");
// $b
// expected : foo%2Fbar%5B%5D=1&foo%2Fbar%5B%5D=2&bar=foo
// produced : foo%2Fbar%5B0%5D=1&foo%2Fbar%5B1%5D=2&bar=foo
$c = urldecode($b);
// $c
// expected : foo/bar[]=1&foo/bar[]=2&bar=foo
// produced : foo/bar[0]=1&foo/bar[1]=2&bar=foo
echo $c;
Expected result:
----------------
foo/bar[]=1&foo/bar[]=2&bar=foo
Actual result:
--------------
foo/bar[0]=1&foo/bar[1]=2&bar=foo
--
Edit bug report at http://bugs.php.net/bug.php?id=52359&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52359&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52359&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52359&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52359&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52359&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52359&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52359&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52359&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52359&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52359&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52359&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52359&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52359&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52359&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52359&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52359&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52359&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52359&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52359&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52359&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52359&r=mysqlcfg