note 95003 added to function.http-build-query
| From: | php at gimme dot org | Date: | Tue, 08 Dec 2009 08:18:20 +0000 |
| Subject: | note 95003 added to function.http-build-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-163708@lists.php.net to get a copy of this message | ||
To: php.net & Marco K. (Germany)
Test the following:
<?php
$param = array(
'_COOKIE' => array(
),
'_HEADER' => array(
'User-Agent' => 'Mozilla...',
),
);
echo http_build_query( $param );
?>
Use your code http_build_query() just return:
&_HEADER[User-Agent]=Mozilla...
And PHP5 http_build_query() just return
_HEADER%5BUser-Agent%5D=Mozilla...
Both http_build_query() function have ignore the
_COOKIE key in this array. I think
http_build_query() Must Return
_COOKIE%5B%5D=&_HEADER%5BUser-Agent%5D=Mozilla...
or
_COOKIE[]=&_HEADER[User-Agent]=Mozilla...
<?php
if( empty( (array)$data ) ){
if( $key === '' )
return '';
else
return sprintf('%s[]=' , $key );
}
foreach ((array)$data as $k => $v) {
....
?>
----
Server IP: 60.191.132.122
Probable Submitter: 125.112.50.8
----
Manual Page -- http://www.php.net/manual/en/function.http-build-query.php
Edit -- https://master.php.net/note/edit/95003
Del: integrated -- https://master.php.net/note/delete/95003/integrated
Del: useless -- https://master.php.net/note/delete/95003/useless
Del: bad code -- https://master.php.net/note/delete/95003/bad+code
Del: spam -- https://master.php.net/note/delete/95003/spam
Del: non-english -- https://master.php.net/note/delete/95003/non-english
Del: in docs -- https://master.php.net/note/delete/95003/in+docs
Del: other reasons-- https://master.php.net/note/delete/95003
Reject -- https://master.php.net/note/reject/95003
Search -- https://master.php.net/manage/user-notes.php