weakrefs_001.phpt 576 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. --TEST--
  2. WeakReference
  3. --FILE--
  4. <?php
  5. $std = new stdClass;
  6. debug_zval_dump($std);
  7. $wr = WeakReference::create($std);
  8. $wr2 = WeakReference::create($std);
  9. debug_zval_dump($std);
  10. var_dump($wr, $wr2);
  11. debug_zval_dump($wr->get());
  12. debug_zval_dump($wr2->get());
  13. unset($std);
  14. debug_zval_dump($wr->get());
  15. debug_zval_dump($wr2->get());
  16. ?>
  17. --EXPECT--
  18. object(stdClass)#1 (0) refcount(2){
  19. }
  20. object(stdClass)#1 (0) refcount(2){
  21. }
  22. object(WeakReference)#2 (0) {
  23. }
  24. object(WeakReference)#2 (0) {
  25. }
  26. object(stdClass)#1 (0) refcount(2){
  27. }
  28. object(stdClass)#1 (0) refcount(2){
  29. }
  30. NULL
  31. NULL