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