Bug #66966 [Com]: __toString not call by http_build_query

From: Date: Tue, 24 Jun 2014 15:07:10 +0000
Subject: Bug #66966 [Com]: __toString not call by http_build_query
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186323@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=66966&edit=1

 ID:                 66966
 Comment by:         dev dot php at ange7 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:

Nobody has any interest about this bug...?


Previous Comments:
------------------------------------------------------------------------
[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)

« previous php.bugs (#186323) next »