ID: 49274 Updated by: paj...@php.net Reported By: cel...@php.net -Status: Analyzed +Status: Assigned Bug Type: Feature/Change Request Operating System: * PHP Version: 5.3SVN-2009-08-16 (SVN) -Assigned To: +Assigned To: pajoye New Comment:
I will close it as soon as it gets merged in 5.3.1, if the RM agrees. Previous Comments: ------------------------------------------------------------------------ [2009-09-05 17:35:27] s...@php.net Automatic comment from SVN on behalf of pajoye Revision: http://svn.php.net/viewvc/?view=revision&revision=288083 Log: - fix #49274, filter_var does not accept object without a toString implementation ------------------------------------------------------------------------ [2009-08-17 21:59:13] paj...@php.net http://pastie.org/586442 should do it. I did not not test more than the test case here. ------------------------------------------------------------------------ [2009-08-17 13:55:58] paj...@php.net it is indeed valid for all objects but it is still an edge case. A check for IS_OBJECT + tostring() existence could be easy enough and with almost no impact(perf impact is null on the existing application). If you have some time to write one, go ahead. ------------------------------------------------------------------------ [2009-08-17 13:52:56] cel...@php.net the stdClass was just to illustrate the point, this happens with any object that doesn't have a __toString(). I would imagine it would be easier to check for IS_OBJECT and then see if it implements __toString than to do a custom error handler. The performance should be about the same (dismal). ------------------------------------------------------------------------ [2009-08-17 13:48:45] paj...@php.net As StdClass has no __toString implementation (obviously), it can't be converted to string. I tend to agree that it should not raise a fatal (recovable error) here as it defeats the main purpose of this API. I'm however not sure it is worth the effort to add custom error handler for this edge case. Patch welcome, it could help to get this edge case solved (I can't work on this exact issue any time soon). ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/49274 -- Edit this bug report at http://bugs.php.net/?id=49274&edit=1