Edit report at http://bugs.php.net/bug.php?id=51245&edit=1
ID: 51245 Updated by: paj...@php.net Reported by: a dot dorn at sitesol dot de Summary: Bug in filter_var with SimpleXMLElement Status: Feedback Type: Bug Package: Unknown/Other Function Operating System: WIN PHP Version: 5.2.13 New Comment: Did you try with 5.3.2 as well? Also please provide a script without using simplexml as it is unrelated to this problem, if any. Previous Comments: ------------------------------------------------------------------------ [2010-03-09 13:04:10] paj...@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2010-03-09 13:02:34] a dot dorn at sitesol dot de Here is the small script: $xmlstring = '<?xml version="1.0" encoding="iso-8859-1"?'.'><file ext="png"> <user id="XXX"/> </file>'; $xml = simplexml_load_string($xmlstring); echo var_dump(filter_var($xml["ext"], FILTER_SANITIZE_STRING)); ------------------------------------------------------------------------ [2010-03-09 12:59:47] a dot dorn at sitesol dot de the behavior in php 5.3.2 is the expected string(3) "png" :-) will you offer a bugfix for php version 5.2.x? ------------------------------------------------------------------------ [2010-03-09 12:45:35] a dot dorn at sitesol dot de ***problematic code: echo var_dump(filter_var($xml["ext"], FILTER_SANITIZE_STRING)); ***expected result (by version 5.2.1): string(3) "png" ***result by version 5.2.12 and 5.2.13 bool(false) ------------------------------------------------------------------------ [2010-03-09 11:51:00] paj...@php.net I don't see a difference betweeen the expected and actual results. Also if there is a problem with filter_var and __toString, please provide a simple script to reproduce it (small class + filter_var only). Also try using 5.3.2 as I have fixed something related to toString there. ------------------------------------------------------------------------ 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/bug.php?id=51245 -- Edit this bug report at http://bugs.php.net/bug.php?id=51245&edit=1