Skip to content

Commit 948ef10

Browse files
committed
Fix ISSET_ISEMPTY_VAR missoptimization
This fixes oss-fuzz #46909
1 parent 1aa5e93 commit 948ef10

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

Zend/Optimizer/zend_optimizer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ int zend_optimizer_update_op1_const(zend_op_array *op_array,
323323
case ZEND_FETCH_IS:
324324
case ZEND_FETCH_UNSET:
325325
case ZEND_FETCH_FUNC_ARG:
326+
case ZEND_ISSET_ISEMPTY_VAR:
327+
case ZEND_UNSET_VAR:
326328
TO_STRING_NOWARN(val);
327329
if (opline->opcode == ZEND_CONCAT && opline->op2_type == IS_CONST) {
328330
opline->opcode = ZEND_FAST_CONCAT;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
ISSET_ISEMPTY_VAR 001: CONST operand of ISSET_ISEMPTY_VAR must be converted to STRING
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.optimization_level=-1
7+
--FILE--
8+
<?php
9+
class A {
10+
function __destruct() {
11+
$i=0;
12+
if (isset($GLOBALS[$i])) y;
13+
}
14+
}
15+
new A;
16+
?>
17+
DONE
18+
--EXPECT--
19+
DONE

0 commit comments

Comments
 (0)