mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Return empty str from quotemeta() on empty str
This commit is contained in:
parent
ab48b45f6c
commit
fdb85a828a
@ -148,6 +148,8 @@ PHP 8.0 UPGRADE NOTES
|
||||
. The 'salt' option of password_hash() is no longer supported. If the 'salt'
|
||||
option is used a warning is generated, the provided salt is ignored, and a
|
||||
generated salt is used instead.
|
||||
. The quotemeta() function will now return an empty string if an empty string
|
||||
was passed. Previously false was returned.
|
||||
|
||||
- Zlib:
|
||||
. gzgetss() has been removed.
|
||||
|
@ -340,7 +340,7 @@ static const func_info_t func_infos[] = {
|
||||
#endif
|
||||
FN("substr", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
|
||||
FN("substr_replace", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING | MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_STRING),
|
||||
F1("quotemeta", MAY_BE_NULL | MAY_BE_FALSE | MAY_BE_STRING),
|
||||
F1("quotemeta", MAY_BE_NULL | MAY_BE_STRING),
|
||||
FN("ucfirst", MAY_BE_NULL | MAY_BE_STRING),
|
||||
FN("lcfirst", MAY_BE_NULL | MAY_BE_STRING),
|
||||
F1("ucwords", MAY_BE_NULL | MAY_BE_STRING),
|
||||
|
@ -2592,8 +2592,8 @@ PHP_FUNCTION(quotemeta)
|
||||
|
||||
old_end = ZSTR_VAL(old) + ZSTR_LEN(old);
|
||||
|
||||
if (ZSTR_VAL(old) == old_end) {
|
||||
RETURN_FALSE;
|
||||
if (ZSTR_LEN(old) == 0) {
|
||||
RETURN_EMPTY_STRING();
|
||||
}
|
||||
|
||||
str = zend_string_safe_alloc(2, ZSTR_LEN(old), 0, 0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
--TEST--
|
||||
Test function quotemeta() - using an empty string is given as str.
|
||||
Test function quotemeta() - using an empty string is given as str
|
||||
--CREDITS--
|
||||
Rodrigo Prado de Jesus <royopa [at] gmail [dot] com>
|
||||
User Group: PHPSP #PHPTestFestBrasil
|
||||
@ -9,4 +9,4 @@ $str = "";
|
||||
var_dump(quotemeta($str));
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
string(0) ""
|
||||
|
Loading…
Reference in New Issue
Block a user