From d94c27dccaa34ce3135ec59eeaaa31d2c776ffe8 Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 12 Nov 2019 10:42:29 +0300 Subject: [PATCH] Fixed JIT for TYPE_CHECK opcode (exception handling in case of undefined argument) --- ext/opcache/jit/zend_jit_x86.dasc | 1 + ext/opcache/tests/jit/type_check_001.phpt | 25 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 ext/opcache/tests/jit/type_check_001.phpt diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc index 6f1913a1a1..dc40387c1b 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 0000000000..c8ef2cf08b --- /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-- + +--FILE-- +getMessage() . "\n"; +} +?> +--EXPECT-- +Exception: Undefined variable: a -- 2.50.1