issue_185_002.phpt 452 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Test V8::executeString() : Issue #185 this on function invocation
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. $v8 = new V8Js();
  8. $JS = <<<EOT
  9. function fn() {
  10. var_dump(typeof this.exit);
  11. };
  12. fn();
  13. EOT;
  14. $v8->executeString($JS);
  15. // now fetch `inst` from V8 and call method from PHP
  16. $fn = $v8->executeString('(fn)');
  17. $fn();
  18. ?>
  19. ===EOF===
  20. --EXPECT--
  21. string(8) "function"
  22. string(8) "function"
  23. ===EOF===