spl_autoload_011.phpt 452 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. SPL: spl_autoload() and object freed
  3. --INI--
  4. include_path=.
  5. --FILE--
  6. <?php
  7. class A {
  8. public $var = 1;
  9. public function autoload() {
  10. echo "var:".$this->var."\n";
  11. }
  12. public function __destruct() {
  13. echo "__destruct__\n";
  14. }
  15. }
  16. $a = new A;
  17. $a->var = 2;
  18. spl_autoload_register(array($a, 'autoload'));
  19. unset($a);
  20. var_dump(class_exists("C", true));
  21. ?>
  22. ===DONE===
  23. --EXPECT--
  24. var:2
  25. bool(false)
  26. ===DONE===
  27. __destruct__