ext/dba: Deprecate passing null|false to dba_key_split() (#15297)

RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_null_and_false_to_dba_key_split
This commit is contained in:
Gina Peter Banyard 2024-08-08 18:59:30 +01:00 committed by GitHub
parent 746b1cf43e
commit bb2836eced
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 1 deletions

3
NEWS
View File

@ -14,6 +14,9 @@ PHP NEWS
. Constants SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING, and SUNFUNCS_RET_DOUBLE
are now deprecated. (Jorg Sowa)
- DBA:
. Passing null or false to dba_key_split() is deprecated. (Grigias)
- DOM:
. Fixed bug GH-15192 (Segmentation fault in dom extension
(html5_serializer)). (nielsdos)

View File

@ -409,6 +409,10 @@ PHP 8.4 UPGRADE NOTES
the associated date_sunset() and date_sunrise() functions in PHP 8.1.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4
- DBA:
. Passing null or false to dba_key_split() is deprecated.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_passing_null_and_false_to_dba_key_split
- DOM:
. Deprecated DOM_PHP_ERR constant.
RFC: https://wiki.php.net/rfc/deprecations_php_8_4#deprecate_dom_php_err_constant

View File

@ -1108,6 +1108,7 @@ PHP_FUNCTION(dba_key_split)
}
if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS(), "z", &zkey) == SUCCESS) {
if (Z_TYPE_P(zkey) == IS_NULL || (Z_TYPE_P(zkey) == IS_FALSE)) {
php_error_docref(NULL, E_DEPRECATED, "Passing false or null is deprecated since 8.4");
RETURN_FALSE;
}
}

View File

@ -17,8 +17,11 @@ var_dump(dba_key_split("[key1]name1[key2]name2"));
var_dump(dba_key_split("[key1]name1"));
?>
--EXPECT--
--EXPECTF--
Deprecated: dba_key_split(): Passing false or null is deprecated since 8.4 in %s on line %d
bool(false)
Deprecated: dba_key_split(): Passing false or null is deprecated since 8.4 in %s on line %d
bool(false)
array(2) {
[0]=>