From bb2836eced81cdf7aeeddafb20c487cea0b5dfc8 Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 8 Aug 2024 18:59:30 +0100 Subject: [PATCH] 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 --- NEWS | 3 +++ UPGRADING | 4 ++++ ext/dba/dba.c | 1 + ext/dba/tests/dba_split.phpt | 5 ++++- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 393aab037a2..4003a5cafe2 100644 --- a/NEWS +++ b/NEWS @@ -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) diff --git a/UPGRADING b/UPGRADING index 51705677354..31fc8cae262 100644 --- a/UPGRADING +++ b/UPGRADING @@ -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 diff --git a/ext/dba/dba.c b/ext/dba/dba.c index c720a441784..b1876f75f34 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -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; } } diff --git a/ext/dba/tests/dba_split.phpt b/ext/dba/tests/dba_split.phpt index 70cbe14caee..76a7ba5f591 100644 --- a/ext/dba/tests/dba_split.phpt +++ b/ext/dba/tests/dba_split.phpt @@ -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]=>