php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #43018 filter_var() does not support arrays as implied by the documentation
Submitted: 2007-10-18 11:46 UTC Modified: 2007-11-21 14:46 UTC
From: lsmith@php.net Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: Irrelevant
Private report: No CVE-ID: None
 [2007-10-18 11:46 UTC] lsmith@php.net
Description:
------------
The documentation for filter_var (http://php.net/manual/en/function.filter-var.php) implies that array's are filtered recursively:

"Value to filter, arrays are filtered recursively."

However passing any array returns false

Reproduce code:
---------------
var_dump(filter_var_array(array('foo', array('bar')), FILTER_UNSAFE_RAW));

Expected result:
----------------
array
  0 => string 'foo' (length=3)
  1 => 
    array
      0 => string 'bar' (length=3)


Actual result:
--------------
false

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-18 13:18 UTC] philip@php.net
Was it once going to work with arrays but then filter_var_array() was created instead? This seems to be the case, and your code example confirms it ;-)
 [2007-11-21 14:46 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 05:00:01 2026 UTC