]> granicus.if.org Git - php/commitdiff
Run arginfo / zpp mismatch tests for methods as well
authorNikita Popov <nikita.ppv@gmail.com>
Fri, 17 Jul 2020 13:50:06 +0000 (15:50 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 21 Jul 2020 12:17:29 +0000 (14:17 +0200)
As a side-effect, this also catches issues where classes are not
prepared for use with newInstanceWithoutConstructor.

Zend/tests/arginfo_zpp_mismatch.phpt

index 9762dd5fce6c56ca102bfe508c0f48f5f916c5de..39a174274396a10ba1f5888f4acc56629c47ba30 100644 (file)
@@ -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]);
     }
 }