bug32252.phpt 670 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. --TEST--
  2. Bug #32252 (Segfault when offsetSet throws an Exception (only without debug))
  3. --FILE--
  4. <?php
  5. class Test implements ArrayAccess
  6. {
  7. function offsetExists($offset)
  8. {
  9. echo __METHOD__ . "($offset)\n";
  10. return false;
  11. }
  12. function offsetGet($offset)
  13. {
  14. echo __METHOD__ . "($offset)\n";
  15. return null;
  16. }
  17. function offsetSet($offset, $value)
  18. {
  19. echo __METHOD__ . "($offset, $value)\n";
  20. throw new Exception("Ooops");
  21. }
  22. function offsetUnset($offset)
  23. {
  24. echo __METHOD__ . "($offset)\n";
  25. }
  26. }
  27. $list = new Test();
  28. try
  29. {
  30. $list[-1] = 123;
  31. }
  32. catch (Exception $e)
  33. {
  34. echo "CAUGHT\n";
  35. }
  36. ?>
  37. ===DONE===
  38. --EXPECT--
  39. Test::offsetSet(-1, 123)
  40. CAUGHT
  41. ===DONE===