/hphp/test/slow/ir_inlining/unset.php

http://github.com/facebook/hiphop-php · PHP · 39 lines · 32 code · 5 blank · 2 comment · 0 complexity · a093f5c3b17e94122613c0c45b433240 MD5 · raw file

  1. <?hh
  2. class NonExistProp {
  3. private $x;
  4. public function __construct() {
  5. $x = "str";
  6. }
  7. public function unsetIt() {
  8. unset($this->x);
  9. }
  10. public function getX() {
  11. return $this->x;
  12. }
  13. }
  14. // TODO: this will need a hopt to enable throw
  15. function thrower() {
  16. //var_dump(debug_backtrace());
  17. throw new Exception("Yo");
  18. }
  19. function test7() {
  20. set_error_handler(fun('thrower'));
  21. try {
  22. $obj = new NonExistProp();
  23. $obj->unsetIt();
  24. $k = new Dtor();
  25. echo $obj->getX();
  26. echo "\n";
  27. }
  28. catch (Exception $x) {
  29. }
  30. }
  31. <<__EntryPoint>>
  32. function main_unset() {
  33. test7();
  34. }