xref: /PHP-8.4/ext/opcache/tests/jit/gh16499.phpt (revision fe513655)
1--TEST--
2GH-16499 (Undefined to null coercion issues for return)
3--EXTENSIONS--
4opcache
5--INI--
6opcache.jit_buffer_size=64M
7--FILE--
8<?php
9function test($cond): ?int {
10    if ($cond) {
11        $i = 'foo';
12    }
13    return $i;
14}
15
16var_dump(test(false));
17var_dump(test(false));
18?>
19--EXPECTF--
20Warning: Undefined variable $i in %sgh16499.php on line 6
21
22Warning: Undefined variable $i in %sgh16499.php on line 6
23NULL
24
25Warning: Undefined variable $i in %sgh16499.php on line 6
26
27Warning: Undefined variable $i in %sgh16499.php on line 6
28NULL