Commit 25687441a3e for php.net
commit 25687441a3eea61e703810853462aebec12a9ca7
Author: Weilin Du <108666168+LamentXU123@users.noreply.github.com>
Date: Tue Apr 7 01:21:50 2026 +0800
ext/standard: add test triggering deprecation when reading $http_response_header via a dynamic fetch
And thus remove the TODO message in zend_compile.c.
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 3af6e235b9a..176dc40b05f 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -2971,7 +2971,6 @@ static zend_op *zend_compile_simple_var_no_cv(znode *result, const zend_ast *ast
opline->extended_value = ZEND_FETCH_GLOBAL;
} else {
- // TODO: Have a test case for this?
if (name_node.op_type == IS_CONST
&& type == BP_VAR_R
&& zend_string_equals_literal(Z_STR(name_node.u.constant), "http_response_header")) {
diff --git a/ext/standard/tests/http/http_response_header_deprecated_dynamic_fetch.phpt b/ext/standard/tests/http/http_response_header_deprecated_dynamic_fetch.phpt
new file mode 100644
index 00000000000..e6b90355a4c
--- /dev/null
+++ b/ext/standard/tests/http/http_response_header_deprecated_dynamic_fetch.phpt
@@ -0,0 +1,16 @@
+--TEST--
+$http_response_header dynamic fetch should warn
+--FILE--
+<?php
+
+function http_response_header() {
+ ${__FUNCTION__} = "OK";
+ var_dump(${__FUNCTION__});
+}
+
+http_response_header();
+
+?>
+--EXPECTF--
+Deprecated: The predefined locally scoped $http_response_header variable is deprecated, call http_get_last_response_headers() instead in %s on line %d
+string(2) "OK"