|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #75096 FILTER_NULL_ON_FAILURE null for not only boolean
Submitted: 2017-08-19 13:45 UTC Modified: 2017-09-04 22:54 UTC
From: aaatoja at o2 dot pl Assigned:
Status: Verified Package: Filter related
PHP Version: 7.1.8 OS: Debian
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-08-19 13:45 UTC] aaatoja at o2 dot pl
According to

FILTER_NULL_ON_FAILURE is described as "Returns NULL for unrecognized boolean values.", used with FILTER_VALIDATE_BOOLEAN.

But this flag also affects other, non-boolean, filters.

Test script:
var_dump(filter_var("123a", FILTER_VALIDATE_EMAIL, FILTER_NULL_ON_FAILURE)); // null
var_dump(filter_var("123a", FILTER_VALIDATE_EMAIL)); // false

var_dump(filter_var("123a", FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE)); // null
var_dump(filter_var("123a", FILTER_VALIDATE_INT)); //false

var_dump(filter_var("123a", FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE)); // null
var_dump(filter_var("123a", FILTER_VALIDATE_IP)); //false

// etc


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-09-04 22:54 UTC]
-Status: Open +Status: Verified -Package: Documentation problem +Package: Filter related
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Apr 23 14:01:23 2021 UTC