php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68582 filter_var_array ignores FILTER_FLAG_NO_ENCODE_QUOTES
Submitted: 2014-12-09 22:45 UTC Modified: 2014-12-17 00:01 UTC
From: jasonpowellux at gmail dot com Assigned:
Status: Not a bug Package: Filter related
PHP Version: 5.6.3 OS: Centos 6.5
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jasonpowellux at gmail dot com
New email:
PHP Version: OS:

 

 [2014-12-09 22:45 UTC] 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) """ 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-09 22:47 UTC] jasonpowellux at gmail dot com
-: jasonpwoellux at gmail dot com +: jasonpowellux at gmail dot com
 [2014-12-09 22:47 UTC] jasonpowellux at gmail dot com
email address corrected
 [2014-12-17 00:01 UTC] kalle@php.net
-Status: Open +Status: Not a bug
 [2014-12-17 00:01 UTC] kalle@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 06:01:29 2024 UTC