array_021.phpt 377 B

1234567891011121314151617181920212223242526272829
  1. --TEST--
  2. SPL: ArrayObject::seek() and exceptions
  3. --FILE--
  4. <?php
  5. class foo extends ArrayObject
  6. {
  7. public function seek($key)
  8. {
  9. echo __METHOD__ . "($key)\n";
  10. throw new Exception("hi");
  11. }
  12. }
  13. $test = new foo(array(1,2,3));
  14. try
  15. {
  16. $test->seek('bar');
  17. }
  18. catch (Exception $e)
  19. {
  20. echo "got exception\n";
  21. }
  22. ?>
  23. --EXPECT--
  24. foo::seek(bar)
  25. got exception