Skip to content

Commit

Permalink
Run arginfo / zpp mismatch tests for methods as well
Browse files Browse the repository at this point in the history
As a side-effect, this also catches issues where classes are not
prepared for use with newInstanceWithoutConstructor.
  • Loading branch information
nikic committed Jul 21, 2020
1 parent 38fb1f8 commit c9881fd
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions Zend/tests/arginfo_zpp_mismatch.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,27 @@ Test that there is no arginfo/zpp mismatch
--FILE--
<?php

foreach (get_defined_functions()["internal"] as $function) {
function test($function) {
try {
@$function(null, null, null, null, null, null, null, null);
} catch (ArgumentCountError|Error) {
} catch (Throwable) {
}
}

foreach (get_defined_functions()["internal"] as $function) {
test($function);
}

foreach (get_declared_classes() as $class) {
try {
$rc = new ReflectionClass($class);
$obj = $rc->newInstanceWithoutConstructor();
} catch (Throwable) {
continue;
}

foreach (get_class_methods($class) as $method) {
test([$obj, $method]);
}
}

Expand Down

0 comments on commit c9881fd

Please sign in to comment.