v8_unset_property.phpt 684 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. --TEST--
  2. Test V8::executeString() : unset property on V8Object
  3. --SKIPIF--
  4. <?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
  5. --FILE--
  6. <?php
  7. $v8 = new V8Js();
  8. $a = $v8->executeString('var a = { bla: 23 }; a');
  9. var_dump($a);
  10. // properties on $a should be unset'able
  11. unset($a->bla);
  12. var_dump($a);
  13. $v8->executeString('print(a.bla + "\\n");');
  14. unset($v8);
  15. try {
  16. // unset not valid, if $v8 object is disposed
  17. unset($a->bla);
  18. }
  19. catch(V8JsException $e) {
  20. var_dump($e->getMessage());
  21. }
  22. ?>
  23. ===EOF===
  24. --EXPECTF--
  25. object(V8Object)#%d (1) {
  26. ["bla"]=>
  27. int(23)
  28. }
  29. object(V8Object)#%d (0) {
  30. }
  31. undefined
  32. string(55) "Can't access V8Object after V8Js instance is destroyed!"
  33. ===EOF===