Skip to content

Commit

Permalink
Don't evaluate functions with partial array arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed May 21, 2019
1 parent 30f1b17 commit 97ba6b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ext/opcache/Optimizer/sccp.c
Expand Up @@ -1798,7 +1798,7 @@ static void sccp_visit_instr(scdf_ctx *scdf, zend_op *opline, zend_ssa_op *ssa_o
args[i] = get_op1_value(ctx, opline,
&ctx->scdf.ssa->ops[opline - ctx->scdf.op_array->opcodes]);
if (args[i]) {
if (IS_BOT(args[i])) {
if (IS_BOT(args[i]) || IS_PARTIAL_ARRAY(args[i])) {
SET_RESULT_BOT(result);
return;
} else if (IS_TOP(args[i])) {
Expand Down
8 changes: 8 additions & 0 deletions ext/opcache/tests/bug78015.phpt
Expand Up @@ -71,6 +71,12 @@ function test8($array) {
return $ret[0];
}

function test9() {
global $x;
$a = ['b' => [$x]];
return serialize($a['b']);
}

var_dump(test1());
var_dump(test2());
var_dump(test3());
Expand All @@ -79,6 +85,7 @@ var_dump(test5());
var_dump(test6());
var_dump(test7());
var_dump(test8([1]));
var_dump(test9());

?>
--EXPECTF--
Expand All @@ -103,3 +110,4 @@ array(2) {
["y"]=>
int(1)
}
string(14) "a:1:{i:0;i:1;}"

0 comments on commit 97ba6b0

Please sign in to comment.