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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lapo at lapo dot it
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 10:01:28 2025 UTC