From 04ebbfcf54d6bde286582e72963e6cf4c25252ca Mon Sep 17 00:00:00 2001 From: Gina Peter Bnayard Date: Thu, 8 Aug 2024 17:57:48 +0200 Subject: [PATCH] ext/dba: Deprecate passing null|false to dba_key_split() 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 393aab037a216..4003a5cafe2ea 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 51705677354f6..31fc8cae26250 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 c720a4417849b..b1876f75f345e 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 70cbe14caee59..76a7ba5f59185 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]=>