bug74345.phpt 979 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. --TEST--
  2. Bug #74345: Call trampoline leaked if callback not invoked
  3. --FILE--
  4. <?php
  5. class Test {
  6. public function __call($name, $args) {
  7. echo "__call()\n";
  8. }
  9. }
  10. $name = "foo" . ($x = "bar");
  11. $cb = [new Test, $name];
  12. array_map($cb, []);
  13. array_map($cb, [], []);
  14. try {
  15. array_map($cb, null);
  16. } catch (Error $e) {
  17. echo $e->getMessage(), "\n";
  18. }
  19. try {
  20. array_map($cb, null, null);
  21. } catch (Error $e) {
  22. echo $e->getMessage(), "\n";
  23. }
  24. array_filter([], $cb);
  25. array_reduce([], $cb);
  26. $array = [];
  27. array_walk($array, $cb);
  28. array_walk_recursive($array, $cb);
  29. usort($array, $cb);
  30. try {
  31. preg_replace_callback('/./', $cb, new stdClass);
  32. } catch (Error $e) {
  33. echo $e->getMessage(), "\n";
  34. }
  35. ?>
  36. ===DONE===
  37. --EXPECT--
  38. array_map(): Argument #2 ($array) must be of type array, null given
  39. array_map(): Argument #2 ($array) must be of type array, null given
  40. preg_replace_callback(): Argument #3 ($subject) must be of type array|string, stdClass given
  41. ===DONE===