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

From: Date: Thu, 27 Mar 2014 12:40:37 +0000
Subject: Bug #66966 [Opn]: __toString not call by http_build_query
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-184925@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 User updated 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.10 +PHP Version: 5.5.9 Block user comment: N Private report: N New Comment: same bug with PHP 5.4.4-14+deb7u8 Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#184925) next »