Bug #68582 [Opn->Nab]: filter_var_array ignores FILTER_FLAG_NO_ENCODE_QUOTES

From: Date: Wed, 17 Dec 2014 00:01:50 +0000
Subject: Bug #68582 [Opn->Nab]: filter_var_array ignores FILTER_FLAG_NO_ENCODE_QUOTES
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189092@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68582&edit=1 ID: 68582 Updated by: kalle@php.net Reported by: jasonpowellux at gmail dot com Summary: filter_var_array ignores FILTER_FLAG_NO_ENCODE_QUOTES -Status: Open +Status: Not a bug Type: Bug Package: Filter related Operating System: Centos 6.5 PHP Version: 5.6.3 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Please see the documentation. http://php.net/manual/en/function.filter-input-array.php http://php.net/manual/en/function.filter-var-array.php Previous Comments: ------------------------------------------------------------------------ [2014-12-09 22:47:19] jasonpowellux at gmail dot com email address corrected ------------------------------------------------------------------------ [2014-12-09 22:45:36] jasonpowellux at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=68582&edit=1

« previous php.bugs (#189092) next »