|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-10-20 08:36 UTC] ibber_of_crew42 at hotmail dot com
Description: ------------ When passing an instance of a class implementing __toString, as the first argument to htmlentities or htmlspecialchars, the object is apparently not always (maybe never?) cast to string before being pushed on the stack. In some cases this will cause php to erronously output that the function requires parameter 2 to be long, unknown given. This seems to be an error from the underlying C function? Sadly, I cannot provide a test script to reproduce the behaviour, but it should be easy enough to check whether my theory is correct. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 18 04:00:01 2025 UTC |
Thanks for your report. However, I can't reproduce this with: <?php class A { function __tostring() { return "aaa"; } } echo htmlspecialchars(new A()); Passing it to parameter 2, gives a message telling parameter 2 should be long, object given. There's nothing out of the ordinary with the implementation of htmlentities/htmlspecialchars, so unless you have a way to reproduce this, I'll close it as bogus in the next few days.