bug35821.phpt 733 B

12345678910111213141516171819202122232425262728293031323334
  1. --TEST--
  2. Bug #35821 (array_map() segfaults when exception is throwed from the callback)
  3. --FILE--
  4. <?php
  5. class Element
  6. {
  7. public function ThrowException ()
  8. {
  9. throw new Exception();
  10. }
  11. public static function CallBack(Element $elem)
  12. {
  13. $elem->ThrowException();
  14. }
  15. }
  16. $arr = array(new Element(), new Element(), new Element());
  17. array_map(array('Element', 'CallBack'), $arr);
  18. echo "Done\n";
  19. ?>
  20. --EXPECTF--
  21. Warning: array_map(): An error occurred while invoking the map callback in %s on line %d
  22. Fatal error: Uncaught exception 'Exception' in %s:%d
  23. Stack trace:
  24. #0 %s(%d): Element->ThrowException()
  25. #1 [internal function]: Element::CallBack(Object(Element))
  26. #2 %s(%d): array_map(Array, Array)
  27. #3 {main}
  28. thrown in %s on line %d