xref: /PHP-8.4/ext/opcache/tests/jit/gh16572.phpt (revision 38e1b0ac)
1--TEST--
2GH-16572 (Incorrect result with reflection in low-trigger JIT)
3--EXTENSIONS--
4opcache
5--INI--
6opcache.jit=1215
7--FILE--
8<?php
9function dumpType(ReflectionType $rt) {
10    var_dump($rt::class);
11    dumpType(null);
12}
13function test1(): int { }
14dumpType((new ReflectionFunction('test1'))->getReturnType());
15?>
16--EXPECTF--
17string(19) "ReflectionNamedType"
18
19Fatal error: Uncaught TypeError: dumpType(): Argument #1 ($rt) must be of type ReflectionType, null given, called in %s on line %d and defined in %s:%d
20Stack trace:
21#0 %s(%d): dumpType(NULL)
22#1 %s(%d): dumpType(Object(ReflectionNamedType))
23#2 {main}
24  thrown in %s on line %d
25