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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
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

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-2021 The PHP Group
All rights reserved.
Last updated: Mon Nov 29 16:03:13 2021 UTC