com php-src: Don't use needs_live_range hook for "s pecial" live ranges: Zend/tests/uncaught_exception _error_supression.phpt Zend/zend_opcode.c
| From: | Nikita Popov | Date: | Mon, 26 Aug 2019 14:12:03 +0000 |
| Subject: | com php-src: Don't use needs_live_range hook for "s pecial" live ranges: Zend/tests/uncaught_exception _error_supression.phpt Zend/zend_opcode.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-108067@lists.php.net to get a copy of this message | ||
Commit: e2b49d6c45f0c5ed69268d32da2f4972265db663
Author: Nikita Popov <nikita.ppv@gmail.com> Mon, 26 Aug 2019 16:10:29 +0200
Parents: 8f897f1040f00210f4a5cdd82a88a1fe3e558955
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=e2b49d6c45f0c5ed69268d32da2f4972265db663
Log:
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.
Changed paths:
A Zend/tests/uncaught_exception_error_supression.phpt
M Zend/zend_opcode.c
Diff:
diff --git a/Zend/tests/uncaught_exception_error_supression.phpt
b/Zend/tests/uncaught_exception_error_supression.phpt
new file mode 100644
index 0000000..1130a9d
--- /dev/null
+++ b/Zend/tests/uncaught_exception_error_supression.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Error suppression should have no impact on uncaught exceptions
+--FILE--
+<?php
+
+function abc() {
+ throw new Error('Example Exception');
+}
+
+@abc();
+
+?>
+--EXPECTF--
+Fatal error: Uncaught Error: Example Exception in %s:%d
+Stack trace:
+#0 %s(%d): abc()
+#1 {main}
+ thrown in %s on line %d
diff --git a/Zend/zend_opcode.c b/Zend/zend_opcode.c
index ff6bcfd..fe81585 100644
--- a/Zend/zend_opcode.c
+++ b/Zend/zend_opcode.c
@@ -655,6 +655,12 @@ static void emit_live_range(
default:
start++;
kind = ZEND_LIVE_TMPVAR;
+
+ /* Check hook to determine whether a live range is necessary,
+ * e.g. based on type info. */
+ if (needs_live_range && !needs_live_range(op_array, orig_def_opline)) {
+ return;
+ }
break;
}
case ZEND_COPY_TMP:
@@ -694,11 +700,6 @@ static void emit_live_range(
}
}
- /* Check hook to determine whether a live range is necessary, e.g. based on type info. */
- if (needs_live_range && !needs_live_range(op_array, orig_def_opline)) {
- return;
- }
-
emit_live_range_raw(op_array, var_num, kind, start, end);
}