mirror of
https://github.com/php/php-src.git
synced 2024-11-28 04:14:26 +08:00
Fixed bug #53037 (FILTER_FLAG_EMPTY_STRING_NULL is not implemented).
This commit is contained in:
parent
4919f3286b
commit
47012ccd8f
3
NEWS
3
NEWS
@ -28,6 +28,9 @@ PHP NEWS
|
||||
- DBA extension:
|
||||
. Fixed bug #54242 (dba_insert returns true if key already exists). (Felipe)
|
||||
|
||||
- Filter extension:
|
||||
. Fixed bug #53037 (FILTER_FLAG_EMPTY_STRING_NULL is not implemented). (Ilia)
|
||||
|
||||
- LDAP extension:
|
||||
. Fixed bug #53339 (Fails to build when compilng with gcc 4.5 and DSO
|
||||
libraries). (Clint Byrum, Raphael)
|
||||
|
@ -205,7 +205,11 @@ void php_filter_string(PHP_INPUT_FILTER_PARAM_DECL)
|
||||
|
||||
if (new_len == 0) {
|
||||
zval_dtor(value);
|
||||
ZVAL_EMPTY_STRING(value);
|
||||
if (flags & FILTER_FLAG_EMPTY_STRING_NULL) {
|
||||
ZVAL_NULL(value);
|
||||
} else {
|
||||
ZVAL_EMPTY_STRING(value);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -280,6 +284,9 @@ void php_filter_unsafe_raw(PHP_INPUT_FILTER_PARAM_DECL)
|
||||
}
|
||||
|
||||
php_filter_encode_html(value, enc);
|
||||
} else if (flags & FILTER_FLAG_EMPTY_STRING_NULL && Z_STRLEN_P(value) == 0) {
|
||||
zval_dtor(value);
|
||||
ZVAL_NULL(value);
|
||||
}
|
||||
}
|
||||
/* }}} */
|
||||
|
14
ext/filter/tests/bug53037.phpt
Normal file
14
ext/filter/tests/bug53037.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #53037 (FILTER_FLAG_EMPTY_STRING_NULL is not implemented)
|
||||
--SKIPIF--
|
||||
<?php if (!extension_loaded("filter")) die("skip"); ?>
|
||||
--FILE--
|
||||
<?php
|
||||
var_dump(
|
||||
filter_var("", FILTER_DEFAULT),
|
||||
filter_var("", FILTER_DEFAULT, array('flags' => FILTER_FLAG_EMPTY_STRING_NULL))
|
||||
);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(0) ""
|
||||
NULL
|
Loading…
Reference in New Issue
Block a user