Antony Dovgal wrote:
> On 04/27/2007 04:35 PM, elias wrote:
>> Hi,
>>
>> why has the support for http arrays (bracket syntax) been removed in
>> PHP   5.1.3 ? Yes [] not allowed by according RFC, but is that a
>> reason for an BC break? Is it an accident or harassment?
> 
> What are you talking about?

probably a reference to the 'correct' but rather annoying BC break in 
http_build_query()
countless php apps make use of the ability of php to automatically convent 
get/post args
whose names are suffixed with square brackets into [sub]arrays in the relevant 
superglobal
array ... some of those app also make use of http_build_query() to 'cleanly' 
create
url query parameter strings that e.g.

$args = array('foo' => array('bar' => array(1,2,3), 'quz' => array(1,2,3)));
echo '/foo.php?'.http_build_query($args);


foo.php --- 8< ---

var_dump($_GET['foo']);


the var_dump() output used to be a neat nested array, but since 5.1.3 [although 
I remember
it as 5.1.6] http_build_query() makes htmlentities of the square brackets so 
therefore
the var_dump() gives you a string.

the workable 'fix' I have been using was to postprocess http_build_query() 
output
with the following - a 'solution' which makes my skin crawl just a little:


function http_build_query_unborker($s)
{
        return preg_replace('#%5[bd](?=[^&]*=)#ei', 'urldecode("\\0")', $s);
}



> 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to