Bug #66966 [Com]: __toString not call by http_build_query
Edit report at https://bugs.php.net/bug.php?id=66966&edit=1
ID: 66966
Comment by: martijn dot otto at copernica dot com
Reported by: dev dot php at ange7 dot com
Summary: __toString not call by http_build_query
Status: Open
Type: Bug
Package: URL related
Operating System: Linux Debian Wheezy
PHP Version: 5.5.9
Block user comment: N
Private report: N
New Comment:
Is there any progress information available for this bug? It's pretty annoying since it means
you always have to roll your own alternative to http_build_query.
Previous Comments:
------------------------------------------------------------------------
[2014-06-24 15:07:09] dev dot php at ange7 dot com
Nobody has any interest about this bug...?
------------------------------------------------------------------------
[2014-03-27 12:40:37] dev dot php at ange7 dot com
same bug with PHP 5.4.4-14+deb7u8
------------------------------------------------------------------------
[2014-03-27 12:34:46] dev dot php at ange7 dot com
Description:
------------
When you call http_build_query() method with array which contain one object, http_build_query
don't call «__toString» method
Test script:
---------------
<?php
class foo {
public function __toString()
{
return "bar";
}
}
$params = array();
$params['a'] = 'b';
$params['foo'] = new foo();
$query = http_build_query($params);
var_dump($params, $query);
Expected result:
----------------
a=b&foo=bar
Actual result:
--------------
a=b
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66966&edit=1
Thread (6 messages)