Bug #68582 [NEW]: filter_var_array ignores FILTER_FLAG_NO_ENCODE_QUOTES

From: Date: Tue, 09 Dec 2014 22:45:37 +0000
Subject: Bug #68582 [NEW]: filter_var_array ignores FILTER_FLAG_NO_ENCODE_QUOTES
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188987@lists.php.net to get a copy of this message
From: jasonpwoellux at gmail dot com Operating system: Centos 6.5 PHP version: 5.6.3 Package: Filter related Bug Type: Bug Bug description:filter_var_array ignores FILTER_FLAG_NO_ENCODE_QUOTES Description: ------------ --- From manual page: http://www.php.net/filter.filters.sanitize --- Test script: --------------- <?php // input an apostrophe or quote in the form below & it will get encoded in the first two var_dump commands, but not the third $cleanPOST1=filter_var_array($_POST,FILTER_SANITIZE_STRING,FILTER_FLAG_NO_ENCODE_QUOTES); $cleanPOST2=filter_input_array(INPUT_POST,FILTER_SANITIZE_STRING,FILTER_FLAG_NO_ENCODE_QUOTES); var_dump($cleanPOST1); echo "<br>"; //will make an apostrophe 5 chars i.e encode it var_dump($cleanPOST2); echo "<br>"; //will make an apostrophe 5 chars i.e encode it var_dump(filter_var($_POST['text'],FILTER_SANITIZE_STRING,FILTER_FLAG_NO_ENCODE_QUOTES)); // won't encode ?> <form action="test.php" enctype="multipart/form-data" method="post"> <input type="text" name="text"> </form> Expected result: ---------------- array(1) { ["text"]=> string(1) """ } array(1) { ["text"]=> string(1) """ } string(1) """ Actual result: -------------- array(1) { ["text"]=> string(5) """ } array(1) { ["text"]=> string(5) """ } string(1) """ -- Edit bug report at https://bugs.php.net/bug.php?id=68582&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68582&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68582&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68582&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=68582&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=68582&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=68582&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=68582&r=needscript Try newer version: https://bugs.php.net/fix.php?id=68582&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=68582&r=support Expected behavior: https://bugs.php.net/fix.php?id=68582&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=68582&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=68582&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=68582&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68582&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=68582&r=dst IIS Stability: https://bugs.php.net/fix.php?id=68582&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=68582&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=68582&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=68582&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=68582&r=mysqlcfg

« previous php.bugs (#188987) next »