php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28591 using an object as a string parameter converts it to a string
Submitted: 2004-05-31 11:50 UTC Modified: 2005-01-09 14:10 UTC
Votes:3
Avg. Score:4.0 ± 1.4
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:2 (66.7%)
From: lapo at lapo dot it Assigned:
Status: Closed Package: Tidy (PECL)
PHP Version: 5.0.0RC2 OS: Win32
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
40 + 38 = ?
Subscribe to this entry?

 
 [2004-05-31 11:50 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-09 14:10 UTC] nlopess@php.net
This is already solved (at least in PHP 5.1).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 08:01:30 2024 UTC