Skip to content

Commit

Permalink
Special handling for $php_errormsg and $http_response_header.
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Sep 15, 2016
1 parent fca15a6 commit 902e9ad
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ext/opcache/Optimizer/zend_inference.c
Original file line number Diff line number Diff line change
Expand Up @@ -4012,13 +4012,19 @@ static int zend_infer_types(const zend_op_array *op_array, const zend_script *sc
zend_type_narrowing(op_array, script, ssa);

for (j = 0; j < op_array->last_var; j++) {
/* $php_errormsg and $http_response_header may be updated indirectly */
if (zend_string_equals_literal(op_array->vars[j], "php_errormsg")) {
/* Mark all SSA vars for $php_errormsg as references,
* to make sure we don't optimize it. */
int i;
for (i = 0; i < ssa_vars_count; i++) {
if (ssa->vars[i].var == j) {
ssa_var_info[i].type |= MAY_BE_REF | MAY_BE_ANY | MAY_BE_ARRAY_KEY_ANY | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
ssa_var_info[i].type |= MAY_BE_STRING | MAY_BE_RC1 | MAY_BE_RCN;
}
}
} else if (zend_string_equals_literal(op_array->vars[j], "http_response_header")) {
int i;
for (i = 0; i < ssa_vars_count; i++) {
if (ssa->vars[i].var == j) {
ssa_var_info[i].type |= MAY_BE_ARRAY | MAY_BE_ARRAY_KEY_LONG | MAY_BE_ARRAY_OF_STRING | MAY_BE_RC1 | MAY_BE_RCN;
}
}
}
Expand Down

0 comments on commit 902e9ad

Please sign in to comment.