arginfo_zpp_mismatch_strict.phpt 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. --TEST--
  2. Test that there is no arginfo/zpp mismatch in strict mode
  3. --SKIPIF--
  4. <?php
  5. if (getenv('SKIP_MSAN')) die("skip msan misses interceptors for some functions");
  6. ?>
  7. --FILE--
  8. <?php
  9. declare(strict_types=1);
  10. require __DIR__ . "/arginfo_zpp_mismatch.inc";
  11. function test($function) {
  12. if (skipFunction($function)) {
  13. return;
  14. }
  15. ob_start();
  16. if (is_string($function)) {
  17. echo "Testing $function\n";
  18. } else {
  19. echo "Testing " . get_class($function[0]) . "::$function[1]\n";
  20. }
  21. try {
  22. @$function();
  23. } catch (Throwable) {
  24. }
  25. try {
  26. @$function(null);
  27. } catch (Throwable) {
  28. }
  29. try {
  30. @$function(null, null);
  31. } catch (Throwable) {
  32. }
  33. try {
  34. @$function(null, null, null);
  35. } catch (Throwable) {
  36. }
  37. try {
  38. @$function(null, null, null, null);
  39. } catch (Throwable) {
  40. }
  41. try {
  42. @$function(null, null, null, null, null);
  43. } catch (Throwable) {
  44. }
  45. try {
  46. @$function(null, null, null, null, null, null);
  47. } catch (Throwable) {
  48. }
  49. try {
  50. @$function(null, null, null, null, null, null, null);
  51. } catch (Throwable) {
  52. }
  53. try {
  54. @$function(null, null, null, null, null, null, null, null);
  55. } catch (Throwable) {
  56. }
  57. ob_end_clean();
  58. }
  59. foreach (get_defined_functions()["internal"] as $function) {
  60. test($function);
  61. }
  62. foreach (get_declared_classes() as $class) {
  63. try {
  64. $rc = new ReflectionClass($class);
  65. $obj = $rc->newInstanceWithoutConstructor();
  66. } catch (Throwable) {
  67. continue;
  68. }
  69. foreach (get_class_methods($class) as $method) {
  70. test([$obj, $method]);
  71. }
  72. }
  73. // var_dump() and debug_zval_dump() print all arguments
  74. ?>
  75. ===DONE===
  76. --EXPECT--
  77. ===DONE===