exception_clearing.phpt 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. --TEST--
  2. Test V8::executeString() : Exception clearing test
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. $v8 = new V8Js(null, array(), array(), false);
  8. var_dump($v8->getPendingException());
  9. $v8->clearPendingException();
  10. var_dump($v8->getPendingException());
  11. $v8->executeString('fooobar', 'throw_0');
  12. var_dump($v8->getPendingException());
  13. $v8->clearPendingException();
  14. var_dump($v8->getPendingException());
  15. ?>
  16. ===EOF===
  17. --EXPECTF--
  18. NULL
  19. NULL
  20. object(V8JsScriptException)#%d (13) {
  21. ["message":protected]=>
  22. string(49) "throw_0:1: ReferenceError: fooobar is not defined"
  23. ["string":"Exception":private]=>
  24. string(0) ""
  25. ["code":protected]=>
  26. int(0)
  27. ["file":protected]=>
  28. string(%d) "%s"
  29. ["line":protected]=>
  30. int(10)
  31. ["trace":"Exception":private]=>
  32. array(1) {
  33. [0]=>
  34. array(6) {
  35. ["file"]=>
  36. string(%d) "%s"
  37. ["line"]=>
  38. int(10)
  39. ["function"]=>
  40. string(13) "executeString"
  41. ["class"]=>
  42. string(4) "V8Js"
  43. ["type"]=>
  44. string(2) "->"
  45. ["args"]=>
  46. array(2) {
  47. [0]=>
  48. string(7) "fooobar"
  49. [1]=>
  50. string(7) "throw_0"
  51. }
  52. }
  53. }
  54. ["previous":"Exception":private]=>
  55. NULL
  56. ["JsFileName":protected]=>
  57. string(7) "throw_0"
  58. ["JsLineNumber":protected]=>
  59. int(1)
  60. ["JsStartColumn":protected]=>
  61. int(0)
  62. ["JsEndColumn":protected]=>
  63. int(1)
  64. ["JsSourceLine":protected]=>
  65. string(7) "fooobar"
  66. ["JsTrace":protected]=>
  67. string(57) "ReferenceError: fooobar is not defined
  68. at throw_0:1:1"
  69. }
  70. NULL
  71. ===EOF===