Edit report at http://bugs.php.net/bug.php?id=51245&edit=1
ID: 51245 Comment by: 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: @paj...@php.net please se my posts [2010-03-09 10:59 UTC] a dot dorn at sitesol dot de no bug in 5.3.2 [2010-03-09 11:02 UTC] a dot dorn at sitesol dot de example script As my problem has been only occured with SimpleXMLElement object, please use (!!!) simple xml to reproduce the bug. My example script (three lines) again (with <?php ?>): :-) <?php $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)); ?> Previous Comments: ------------------------------------------------------------------------ [2010-03-09 13:05:28] paj...@php.net 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. ------------------------------------------------------------------------ [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) ------------------------------------------------------------------------ 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