Skip to content

Commit 1cfc69d

Browse files
committed
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Check exception after QM_ASSIGN of undef var
2 parents 1e4a9a4 + f381079 commit 1cfc69d

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8252,6 +8252,9 @@ static int zend_jit_qm_assign(dasm_State **Dst, const zend_op *opline, uint32_t
82528252
if (!zend_jit_store_var_if_necessary(Dst, opline->result.var, res_addr, res_info)) {
82538253
return 0;
82548254
}
8255+
if (op1_info & MAY_BE_UNDEF) {
8256+
zend_jit_check_exception(Dst);
8257+
}
82558258
return 1;
82568259
}
82578260

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8810,6 +8810,9 @@ static int zend_jit_qm_assign(dasm_State **Dst, const zend_op *opline, uint32_t
88108810
if (!zend_jit_store_var_if_necessary(Dst, opline->result.var, res_addr, res_info)) {
88118811
return 0;
88128812
}
8813+
if (op1_info & MAY_BE_UNDEF) {
8814+
zend_jit_check_exception(Dst);
8815+
}
88138816
return 1;
88148817
}
88158818

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
--TEST--
2+
QM_ASSIGN of undef var may throw exception
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--FILE--
9+
<?php
10+
set_error_handler(function($_, $m) { throw new Exception($m); });
11+
function test() {
12+
$a = $b;
13+
X;
14+
}
15+
try {
16+
test();
17+
} catch (Exception $e) {
18+
echo $e->getMessage(), "\n";
19+
}
20+
?>
21+
--EXPECT--
22+
Undefined variable $b

0 commit comments

Comments
 (0)