Bug #50407 [Com]: http_build_query() on empty array

From: Date: Wed, 06 Oct 2010 11:42:30 +0000
Subject: Bug #50407 [Com]: http_build_query() on empty array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-154944@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=50407&edit=1

 ID:                 50407
 Comment by:         adam dot zivner at gmail dot com
 Reported by:        php at gimme dot org
 Summary:            http_build_query() on empty array
 Status:             Bogus
 Type:               Bug
 Package:            URL related
 Operating System:   Win
 PHP Version:        5.2.11
 Block user comment: N

 New Comment:

Applications often make distinction between empty and not set.

Example:

Set filter to '': http://example.com/articles/?filter=
Don't change filter, get it from cookies: http://example.com/articles/

But of course, this could be wrong way of using this. Is suggested
explanation 
part of some standard/specification?


Previous Comments:
------------------------------------------------------------------------
[2009-12-08 10:05:03] jani@php.net

Not setting is same as setting it empty. No bug.

------------------------------------------------------------------------
[2009-12-08 08:31:10] php at gimme dot org

Description:
------------
http_build_query() ignore the key in array( key => array() )..

Reproduce code:
---------------
<?php

$param = array(
	'_COOKIE' => array(),
	'_HEADER' => array(
		'User-Agent' => 'Mozilla...' ,
	),
);

echo http_build_query( $param );

?>

Expected result:
----------------
_COOKIE%5B0%D=&_HEADER%5BUser-Agent%5D=Mozilla...

Actual result:
--------------
_HEADER%5BUser-Agent%5D=Mozilla...


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=50407&edit=1


Thread (6 messages)

« previous php.bugs (#154944) next »