Skip to content

Commit 739698c

Browse files
committed
Merge branch 'PHP-7.1'
2 parents dac600e + 8106c01 commit 739698c

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

ext/opcache/Optimizer/block_pass.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,9 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
254254
src = VAR_SOURCE(opline->op1);
255255
if (src &&
256256
(src->opcode == ZEND_BOOL || src->opcode == ZEND_BOOL_NOT)) {
257-
/* T = BOOL(X), FREE(T) => NOP */
258-
if (ZEND_OP1_TYPE(src) == IS_CONST) {
259-
literal_dtor(&ZEND_OP1_LITERAL(src));
260-
}
257+
/* T = BOOL(X), FREE(T) => T = BOOL(X) */
258+
/* The remaining BOOL is removed by a separate optimization */
261259
VAR_SOURCE(opline->op1) = NULL;
262-
MAKE_NOP(src);
263260
MAKE_NOP(opline);
264261
}
265262
} else if (opline->op1_type == IS_VAR) {
@@ -1650,7 +1647,7 @@ static void zend_t_usage(zend_cfg *cfg, zend_op_array *op_array, zend_bitset use
16501647
if (ZEND_OP1_TYPE(opline) == IS_CV) {
16511648
opline->opcode = ZEND_CHECK_VAR;
16521649
SET_UNUSED(opline->result);
1653-
} else if (ZEND_OP1_TYPE(opline) == IS_TMP_VAR) {
1650+
} else if (ZEND_OP1_TYPE(opline) & (IS_TMP_VAR|IS_VAR)) {
16541651
opline->opcode = ZEND_FREE;
16551652
SET_UNUSED(opline->result);
16561653
} else {

ext/opcache/tests/block_pass_001.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
--TEST--
2-
Block pass: Don't suppress undefined variable notice
2+
Block pass: Bugs in BOOL/QM_ASSIGN elision
33
--FILE--
44
<?php
55
(bool) (true ? $x : $y);
6+
(bool) (true ? new stdClass : null);
7+
(bool) new stdClass;
68
?>
79
--EXPECTF--
810
Notice: Undefined variable: x in %s on line %d

0 commit comments

Comments
 (0)