Skip to content

Commit e2b49d6

Browse files
committed
Don't use needs_live_range hook for "special" live ranges
In particular we were disgarding SILENCE live ranges in opcache, because we decided that a MAY_BE_LONG type does not need a live range.
1 parent 8f897f1 commit e2b49d6

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
Error suppression should have no impact on uncaught exceptions
3+
--FILE--
4+
<?php
5+
6+
function abc() {
7+
throw new Error('Example Exception');
8+
}
9+
10+
@abc();
11+
12+
?>
13+
--EXPECTF--
14+
Fatal error: Uncaught Error: Example Exception in %s:%d
15+
Stack trace:
16+
#0 %s(%d): abc()
17+
#1 {main}
18+
thrown in %s on line %d

Zend/zend_opcode.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,12 @@ static void emit_live_range(
655655
default:
656656
start++;
657657
kind = ZEND_LIVE_TMPVAR;
658+
659+
/* Check hook to determine whether a live range is necessary,
660+
* e.g. based on type info. */
661+
if (needs_live_range && !needs_live_range(op_array, orig_def_opline)) {
662+
return;
663+
}
658664
break;
659665
}
660666
case ZEND_COPY_TMP:
@@ -694,11 +700,6 @@ static void emit_live_range(
694700
}
695701
}
696702

697-
/* Check hook to determine whether a live range is necessary, e.g. based on type info. */
698-
if (needs_live_range && !needs_live_range(op_array, orig_def_opline)) {
699-
return;
700-
}
701-
702703
emit_live_range_raw(op_array, var_num, kind, start, end);
703704
}
704705

0 commit comments

Comments
 (0)