Skip to content

Commit 2b1f8ab

Browse files
committed
Merge branch 'PHP-8.1'
* PHP-8.1: JIT: Fix exception handling
2 parents 024755c + 655e578 commit 2b1f8ab

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

ext/opcache/jit/zend_jit_helpers.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2374,6 +2374,9 @@ static zval * ZEND_FASTCALL zend_jit_prepare_assign_dim_ref(zval *ref) {
23742374
if (Z_TYPE_P(val) == IS_FALSE) {
23752375
ZVAL_ARR(val, zend_new_array(8));
23762376
zend_false_to_array_deprecated();
2377+
if (EG(exception)) {
2378+
return NULL;
2379+
}
23772380
} else {
23782381
ZVAL_ARR(val, zend_new_array(8));
23792382
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
--TEST--
2+
JIT ASSIGN_DIM: 011
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+
$my_var = null <
11+
set_error_handler(function($code, $msg) use(&$my_var) {
12+
echo "Err: $msg\n";
13+
$my_var[] = $my_var = 0;
14+
});
15+
try {
16+
$my_var[] = "";
17+
} catch (Throwable $e) {
18+
echo "Exception: " . $e->getMessage() . "\n";
19+
}
20+
?>
21+
DONE
22+
--EXPECT--
23+
Err: Automatic conversion of false to array is deprecated
24+
Exception: Cannot use a scalar value as an array
25+
DONE

0 commit comments

Comments
 (0)