Annotation of embedaddon/php/ext/standard/tests/array/bug35821.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #35821 (array_map() segfaults when exception is throwed from the callback)
! 3: --FILE--
! 4: <?php
! 5:
! 6: class Element
! 7: {
! 8: public function ThrowException ()
! 9: {
! 10: throw new Exception();
! 11: }
! 12:
! 13: public static function CallBack(Element $elem)
! 14: {
! 15: $elem->ThrowException();
! 16: }
! 17: }
! 18:
! 19: $arr = array(new Element(), new Element(), new Element());
! 20: array_map(array('Element', 'CallBack'), $arr);
! 21:
! 22: echo "Done\n";
! 23: ?>
! 24: --EXPECTF--
! 25:
! 26: Warning: array_map(): An error occurred while invoking the map callback in %s on line %d
! 27:
! 28: Fatal error: Uncaught exception 'Exception' in %s:%d
! 29: Stack trace:
! 30: #0 %s(%d): Element->ThrowException()
! 31: #1 [internal function]: Element::CallBack(Object(Element))
! 32: #2 %s(%d): array_map(Array, Array)
! 33: #3 {main}
! 34: thrown in %s on line %d
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>