com php-src: Fixed JIT for TYPE_CHECK opcode (exception handling in case of undefined argument): ext /opcache/jit/zend_jit_x86.dasc
ext/opcache/tests/ji t/type_check_001.phpt
| From: | Dmitry Stogov | Date: | Tue, 12 Nov 2019 07:42:29 +0000 |
| Subject: | com php-src: Fixed JIT for TYPE_CHECK opcode (exception handling in case of undefined argument): ext /opcache/jit/zend_jit_x86.dasc ext/opcache/tests/ji t/type_check_001.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-109247@lists.php.net to get a copy of this message | ||
Commit: d94c27dccaa34ce3135ec59eeaaa31d2c776ffe8
Author: Dmitry Stogov <dmitry@zend.com> Tue, 12 Nov 2019 10:42:29 +0300
Parents: 937fa6d9e2f38b5e70a2a510b87ce0be4839a404
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d94c27dccaa34ce3135ec59eeaaa31d2c776ffe8
Log:
Fixed JIT for TYPE_CHECK opcode (exception handling in case of undefined argument)
Changed paths:
M ext/opcache/jit/zend_jit_x86.dasc
A ext/opcache/tests/jit/type_check_001.phpt
Diff:
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index 6f1913a1a1e..dc40387c1b2 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -8028,6 +8028,7 @@ static int zend_jit_type_check(dasm_State **Dst, const zend_op *opline, int b,
i
| SAVE_VALID_OPLINE opline
| mov FCARG1d, opline->op1.var
| EXT_CALL zend_jit_undefined_op_helper, r0
+ zend_jit_check_exception_undef_result(Dst, opline);
if (opline->extended_value & MAY_BE_NULL) {
if (!zend_jit_smart_true(Dst, opline, b, op_array, ssa, (op1_info & (MAY_BE_ANY|MAY_BE_REF))
!= 0, smart_branch)) {
return 0;
diff --git a/ext/opcache/tests/jit/type_check_001.phpt b/ext/opcache/tests/jit/type_check_001.phpt
new file mode 100644
index 00000000000..c8ef2cf08ba
--- /dev/null
+++ b/ext/opcache/tests/jit/type_check_001.phpt
@@ -0,0 +1,25 @@
+--TEST--
+JIT TYPE_CHECK: 001 exception handling
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+set_error_handler(function($no, $msg) {
+ throw new Exception($msg);
+});
+
+try {
+ if (!is_scalar($a)) {
+ undefined_function('Null');
+ }
+} catch (Exception $e) {
+ echo "Exception: " . $e->getMessage() . "\n";
+}
+?>
+--EXPECT--
+Exception: Undefined variable: a