Skip to content

Commit c9881fd

Browse files
committed
Run arginfo / zpp mismatch tests for methods as well
As a side-effect, this also catches issues where classes are not prepared for use with newInstanceWithoutConstructor.
1 parent 38fb1f8 commit c9881fd

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

Zend/tests/arginfo_zpp_mismatch.phpt

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,27 @@ Test that there is no arginfo/zpp mismatch
33
--FILE--
44
<?php
55

6-
foreach (get_defined_functions()["internal"] as $function) {
6+
function test($function) {
77
try {
88
@$function(null, null, null, null, null, null, null, null);
9-
} catch (ArgumentCountError|Error) {
9+
} catch (Throwable) {
10+
}
11+
}
12+
13+
foreach (get_defined_functions()["internal"] as $function) {
14+
test($function);
15+
}
16+
17+
foreach (get_declared_classes() as $class) {
18+
try {
19+
$rc = new ReflectionClass($class);
20+
$obj = $rc->newInstanceWithoutConstructor();
21+
} catch (Throwable) {
22+
continue;
23+
}
24+
25+
foreach (get_class_methods($class) as $method) {
26+
test([$obj, $method]);
1027
}
1128
}
1229

0 commit comments

Comments
 (0)