Skip to content

Commit d94c27d

Browse files
committed
Fixed JIT for TYPE_CHECK opcode (exception handling in case of undefined argument)
1 parent 937fa6d commit d94c27d

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8028,6 +8028,7 @@ static int zend_jit_type_check(dasm_State **Dst, const zend_op *opline, int b, i
80288028
| SAVE_VALID_OPLINE opline
80298029
| mov FCARG1d, opline->op1.var
80308030
| EXT_CALL zend_jit_undefined_op_helper, r0
8031+
zend_jit_check_exception_undef_result(Dst, opline);
80318032
if (opline->extended_value & MAY_BE_NULL) {
80328033
if (!zend_jit_smart_true(Dst, opline, b, op_array, ssa, (op1_info & (MAY_BE_ANY|MAY_BE_REF)) != 0, smart_branch)) {
80338034
return 0;
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
JIT TYPE_CHECK: 001 exception handling
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--SKIPIF--
9+
<?php require_once('skipif.inc'); ?>
10+
--FILE--
11+
<?php
12+
set_error_handler(function($no, $msg) {
13+
throw new Exception($msg);
14+
});
15+
16+
try {
17+
if (!is_scalar($a)) {
18+
undefined_function('Null');
19+
}
20+
} catch (Exception $e) {
21+
echo "Exception: " . $e->getMessage() . "\n";
22+
}
23+
?>
24+
--EXPECT--
25+
Exception: Undefined variable: a

0 commit comments

Comments
 (0)