issue_185_001.phpt 611 B

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