Skip to content

Commit 2568744

Browse files
authored
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.
1 parent 5279185 commit 2568744

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Zend/zend_compile.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2971,7 +2971,6 @@ static zend_op *zend_compile_simple_var_no_cv(znode *result, const zend_ast *ast
29712971

29722972
opline->extended_value = ZEND_FETCH_GLOBAL;
29732973
} else {
2974-
// TODO: Have a test case for this?
29752974
if (name_node.op_type == IS_CONST
29762975
&& type == BP_VAR_R
29772976
&& zend_string_equals_literal(Z_STR(name_node.u.constant), "http_response_header")) {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
$http_response_header dynamic fetch should warn
3+
--FILE--
4+
<?php
5+
6+
function http_response_header() {
7+
${__FUNCTION__} = "OK";
8+
var_dump(${__FUNCTION__});
9+
}
10+
11+
http_response_header();
12+
13+
?>
14+
--EXPECTF--
15+
Deprecated: The predefined locally scoped $http_response_header variable is deprecated, call http_get_last_response_headers() instead in %s on line %d
16+
string(2) "OK"

0 commit comments

Comments
 (0)