bug73423.phpt 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. --TEST--
  2. Bug #73423 (Reproducible crash with GDB backtrace)
  3. --FILE--
  4. <?php
  5. class foo implements \RecursiveIterator
  6. {
  7. public $foo = [];
  8. public Function current(): mixed
  9. {
  10. return current ($this->foo);
  11. }
  12. public Function key(): mixed
  13. {
  14. return key ($this->foo);
  15. }
  16. public Function next(): void
  17. {
  18. next ($this->foo);
  19. }
  20. public Function rewind(): void
  21. {
  22. reset ($this->foo);
  23. }
  24. public Function valid(): bool
  25. {
  26. return current ($this->foo) !== false;
  27. }
  28. public Function getChildren(): ?RecursiveIterator
  29. {
  30. return current ($this->foo);
  31. }
  32. public Function hasChildren(): bool
  33. {
  34. return (bool) count($this->foo);
  35. }
  36. }
  37. class fooIterator extends \RecursiveFilterIterator
  38. {
  39. public Function __destruct ()
  40. {
  41. eval("class A extends NotExists {}");
  42. /* CRASH */
  43. }
  44. public Function accept(): bool
  45. {
  46. return true;
  47. }
  48. }
  49. $foo = new foo ();
  50. $foo->foo[] = new foo ();
  51. foreach (new \RecursiveIteratorIterator (new fooIterator ($foo)) as $bar) ;
  52. ?>
  53. --EXPECTF--
  54. Fatal error: Uncaught Error: Class "NotExists" not found in %s:%d
  55. Stack trace:
  56. #0 %s(%d): eval()
  57. #1 %s(%d): fooIterator->__destruct()
  58. #2 {main}
  59. Next Error: Class "NotExists" not found in %s:%d
  60. Stack trace:
  61. #0 %s(%d): eval()
  62. #1 %s(%d): fooIterator->__destruct()
  63. #2 {main}
  64. thrown in %s on line %d