Bug #52359 [Opn->Bgs]: http_build_query seem to encode array incorrectly
| From: | aharvey@php.net | Date: | Mon, 19 Jul 2010 09:54:52 +0000 |
| Subject: | Bug #52359 [Opn->Bgs]: http_build_query seem to encode array incorrectly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-152521@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52359&edit=1
ID: 52359
Updated by: aharvey@php.net
Reported by: jj at danskscanning dot dk
Summary: http_build_query seem to encode array incorrectly
-Status: Open
+Status: Bogus
Type: Bug
Package: URL related
Operating System: Windows XP SP3
PHP Version: Irrelevant
New Comment:
http_build_query() encodes the numeric keys in the output. This is
expected (and documented) behaviour.
Previous Comments:
------------------------------------------------------------------------
[2010-07-17 23:26:03] k.schroeder@php.net
Automatic comment from SVN on behalf of k.schroeder
Revision: http://svn.php.net/viewvc/?view=revision&revision=301354
Log: Test for #52359
------------------------------------------------------------------------
[2010-07-16 11:25:04] jj at danskscanning dot dk
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 this bug report at http://bugs.php.net/bug.php?id=52359&edit=1