From 18f80fb5ced6019979c5d7d391f66a9313702ded Mon Sep 17 00:00:00 2001 From: Gina Peter Banyard Date: Thu, 28 Aug 2025 00:51:35 +0200 Subject: [PATCH] ext/standard: Fix GH-19610 (Deprecation warnings in functions taking as argument) --- NEWS | 4 ++++ Zend/zend_compile.c | 2 ++ .../http_response_header_deprecated_parameter.phpt | 14 ++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 ext/standard/tests/http/http_response_header_deprecated_parameter.phpt diff --git a/NEWS b/NEWS index c5a7aba53d2e1..84f7de878cd58 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,10 @@ PHP NEWS - Session: . Fix RC violation of session SID constant deprecation attribute. (ilutov) +- Standard: + . Fix GH-19610 (Deprecation warnings in functions taking as argument). + (Girgias) + - URI: . Fixed memory management of Uri\WhatWg\Url objects. (timwolla) . Fixed memory management of the internal "parse_url" URI parser. diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 0a7ab7da1bd5f..875239515441e 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -7800,6 +7800,8 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32 ZSTR_VAL(name)); } else if (zend_string_equals(name, ZSTR_KNOWN(ZEND_STR_THIS))) { zend_error_noreturn(E_COMPILE_ERROR, "Cannot use $this as parameter"); + } else if (zend_string_equals_literal(name, "http_response_header")) { + CG(context).has_assigned_to_http_response_header = true; } if (op_array->fn_flags & ZEND_ACC_VARIADIC) { diff --git a/ext/standard/tests/http/http_response_header_deprecated_parameter.phpt b/ext/standard/tests/http/http_response_header_deprecated_parameter.phpt new file mode 100644 index 0000000000000..1dd032a30527e --- /dev/null +++ b/ext/standard/tests/http/http_response_header_deprecated_parameter.phpt @@ -0,0 +1,14 @@ +--TEST-- +$http_reponse_header as a parameter name should not warn +--FILE-- + +--EXPECT-- +string(2) "OK"