issue_156_001.phpt 721 B

123456789101112131415161718192021222324252627282930313233
  1. --TEST--
  2. Test V8::executeString() : Backwards compatibility for issue #156
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --INI--
  6. v8js.compat_php_exceptions = 1
  7. --FILE--
  8. <?php
  9. $v8 = new V8Js();
  10. $v8->throwPHPException = function () {
  11. echo "throwing PHP exception now ...\n";
  12. throw new \Exception('foo');
  13. };
  14. $JS = <<< EOT
  15. PHP.throwPHPException();
  16. print("... old behaviour was to not stop JS execution on PHP exceptions\\n");
  17. EOT;
  18. try {
  19. $v8->executeString($JS, 'issue_156_001.js');
  20. } catch(Exception $e) {
  21. var_dump($e->getMessage());
  22. }
  23. ?>
  24. ===EOF===
  25. --EXPECT--
  26. throwing PHP exception now ...
  27. ... old behaviour was to not stop JS execution on PHP exceptions
  28. string(3) "foo"
  29. ===EOF===