Bug #68582 [Opn]: filter_var_array ignores FILTER_FLAG_NO_ENCODE_QUOTES

From: Date: Tue, 09 Dec 2014 22:47:19 +0000
Subject: Bug #68582 [Opn]: filter_var_array ignores FILTER_FLAG_NO_ENCODE_QUOTES
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188988@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 User updated by: jasonpowellux at gmail dot com Reported by: jasonpowellux at gmail dot com Summary: filter_var_array ignores FILTER_FLAG_NO_ENCODE_QUOTES Status: Open Type: Bug Package: Filter related Operating System: Centos 6.5 PHP Version: 5.6.3 Block user comment: N Private report: N New Comment: email address corrected Previous Comments: ------------------------------------------------------------------------ [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 (#188988) next »