Skip to content

Commit 27efd12

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: Fix ISSET_ISEMPTY_VAR missoptimization
2 parents 73514d6 + 948ef10 commit 27efd12

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
@@ -413,6 +413,8 @@ bool zend_optimizer_update_op1_const(zend_op_array *op_array,
413413
case ZEND_FETCH_IS:
414414
case ZEND_FETCH_UNSET:
415415
case ZEND_FETCH_FUNC_ARG:
416+
case ZEND_ISSET_ISEMPTY_VAR:
417+
case ZEND_UNSET_VAR:
416418
TO_STRING_NOWARN(val);
417419
if (opline->opcode == ZEND_CONCAT && opline->op2_type == IS_CONST) {
418420
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)