#28591 [Com]: using an object as a string parameter converts it to a string
| From: | jed at jed dot bz | Date: | Tue, 01 Jun 2004 05:20:46 +0000 |
| Subject: | #28591 [Com]: using an object as a string parameter converts it to a string | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-60229@lists.php.net to get a copy of this message | ||
ID: 28591
Comment by: jed at jed dot bz
Reported By: lapo at lapo dot it
Status: Open
Bug Type: Zend Engine 2 problem
Operating System: Win32
PHP Version: 5.0.0RC2
New Comment:
Reproduced.
Previous Comments:
------------------------------------------------------------------------
[2004-05-31 11:50:00] lapo at lapo dot it
Description:
------------
Tidy-PHP binding documentation is not very clear (yep, I will RTFS
someday) but in each example uses the output $tidy object directly in
an "echo" just to output it's value, using (I guess) it's internal
__toString() method.
As far as I do "echo" it, no problem, but passing it to a
string-accepting function actually converts it to a string instead of
just using the output of its toString method.
Reproduce code:
---------------
$tidy = tidy_parse_string('<b>Just a try', array(), 'UTF8');
$a = htmlspecialchars($tidy . '');
echo gettype($tidy) . ', ';
$a = htmlspecialchars($tidy);
echo gettype($tidy);
Expected result:
----------------
Output: object, object
Actual result:
--------------
Output: object, string
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28591&edit=1