xref: /PHP-8.3/ext/reflection/tests/bug52854.phpt (revision f8d79582)
1--TEST--
2Bug #52854: ReflectionClass::newInstanceArgs does not work for classes without constructors
3--FILE--
4<?php
5class Test {
6}
7$c = new ReflectionClass('Test');
8var_dump(new Test);
9var_dump(new Test());
10var_dump($c->newInstance());
11var_dump($c->newInstanceArgs(array()));
12
13try {
14    var_dump($c->newInstanceArgs(array(1)));
15} catch(ReflectionException $e) {
16    echo $e->getMessage()."\n";
17}
18?>
19--EXPECTF--
20object(Test)#%d (0) {
21}
22object(Test)#%d (0) {
23}
24object(Test)#%d (0) {
25}
26object(Test)#%d (0) {
27}
28Class Test does not have a constructor, so you cannot pass any constructor arguments
29