php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53037 activate FILTER_FLAG_EMPTY_STRING_NULL
Submitted: 2010-10-10 18:13 UTC Modified: 2011-04-03 18:31 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: jinmoku at hotmail dot com Assigned: iliaa (profile)
Status: Closed Package: Filter related
PHP Version: 5.3.6 OS:
Private report: No CVE-ID: None
 [2010-10-10 18:13 UTC] jinmoku at hotmail dot com
Description:
------------
Hi, there are any plan for FILTER_FLAG_EMPTY_STRING_NULL ?

And why 'NULL' insteed 'FALSE' ?

;)

Test script:
---------------
$str = '';
$filter = filter_var($str, FILTER_DEFAULT, FILTER_FLAG_EMPTY_STRING_NULL);    
var_dump($filter);

Expected result:
----------------
NULL

Actual result:
--------------
string(0) ""

Patches

fix-bug-try (last revision 2011-03-28 22:17 UTC by jinmoku at hotmail dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-03-29 00:21 UTC] jinmoku at hotmail dot com
-PHP Version: 5.3.3 +PHP Version: 5.3.6
 [2011-03-29 00:21 UTC] jinmoku at hotmail dot com
Added patch
 [2011-04-03 18:30 UTC] iliaa@php.net
Automatic comment from SVN on behalf of iliaa
Revision: http://svn.php.net/viewvc/?view=revision&revision=309920
Log: Fixed bug #53037 (FILTER_FLAG_EMPTY_STRING_NULL is not implemented).
 [2011-04-03 18:31 UTC] iliaa@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: iliaa
 [2011-04-03 18:31 UTC] iliaa@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 [2011-04-08 17:49 UTC] jinmoku at hotmail dot com
maybe it's should work with others filters :

var_dump(filter_var("", FILTER_DEFAULT, array('flags' => FILTER_FLAG_EMPTY_STRING_NULL)));
var_dump(filter_var("", FILTER_UNSAFE_RAW, array('flags' => FILTER_FLAG_EMPTY_STRING_NULL)));
var_dump(filter_var("", FILTER_SANITIZE_STRING, array('flags' => FILTER_FLAG_EMPTY_STRING_NULL)));
var_dump(filter_var("", FILTER_SANITIZE_STRIPPED, array('flags' => FILTER_FLAG_EMPTY_STRING_NULL)));
var_dump(filter_var("", FILTER_SANITIZE_ENCODED, array('flags' => FILTER_FLAG_EMPTY_STRING_NULL)));
var_dump(filter_var("", FILTER_SANITIZE_SPECIAL_CHARS, array('flags' => FILTER_FLAG_EMPTY_STRING_NULL)));
var_dump(filter_var("", FILTER_SANITIZE_FULL_SPECIAL_CHARS, array('flags' => FILTER_FLAG_EMPTY_STRING_NULL)));
var_dump(filter_var("", FILTER_SANITIZE_EMAIL, array('flags' => FILTER_FLAG_EMPTY_STRING_NULL)));
var_dump(filter_var("", FILTER_SANITIZE_URL, array('flags' => FILTER_FLAG_EMPTY_STRING_NULL)));
var_dump(filter_var("", FILTER_SANITIZE_NUMBER_INT, array('flags' => FILTER_FLAG_EMPTY_STRING_NULL)));
var_dump(filter_var("", FILTER_SANITIZE_NUMBER_FLOAT, array('flags' => FILTER_FLAG_EMPTY_STRING_NULL)));
var_dump(filter_var("", FILTER_SANITIZE_MAGIC_QUOTES, array('flags' => FILTER_FLAG_EMPTY_STRING_NULL)));
 [2011-04-08 17:49 UTC] jinmoku at hotmail dot com
NULL
NULL
NULL
NULL
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
string(0) ""
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 19:01:27 2024 UTC