Skip to content

Commit 83f283f

Browse files
committed
Undef result on throwing typed reference assignment
1 parent 4c8093a commit 83f283f

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5995,7 +5995,7 @@ static int zend_jit_assign_to_typed_ref(dasm_State **Dst,
59955995
| // if (UNEXPECTED(EG(exception) != NULL)) {
59965996
| MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
59975997
| je >8 // END OF zend_jit_assign_to_variable()
5998-
| jmp ->exception_handler
5998+
| jmp ->exception_handler_undef
59995999
} else {
60006000
| jmp >8
60016001
}

ext/opcache/tests/jit/assign_040.phpt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
JIT ASSIGN: Typed reference error with return value
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
opcache.protect_memory=1
9+
--FILE--
10+
<?php
11+
class Test {
12+
public string $x;
13+
}
14+
function test() {
15+
$test = new Test;
16+
$test->x = "";
17+
$r =& $test->x;
18+
+($r = $y);
19+
}
20+
try {
21+
test();
22+
} catch (TypeError $e) {
23+
echo $e->getMessage(), "\n";
24+
}
25+
--EXPECTF--
26+
Warning: Undefined variable $y in %s on line %d
27+
Cannot assign null to reference held by property Test::$x of type string

0 commit comments

Comments
 (0)