destructor_visibility_001.phpt 415 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. ZE2 Ensuring destructor visibility
  3. --FILE--
  4. <?php
  5. class Base {
  6. private function __destruct() {
  7. echo __METHOD__ . "\n";
  8. }
  9. }
  10. class Derived extends Base {
  11. }
  12. $obj = new Derived;
  13. unset($obj);
  14. ?>
  15. ===DONE===
  16. --EXPECTF--
  17. Fatal error: Uncaught Error: Call to private Derived::__destruct() from global scope in %s:%d
  18. Stack trace:
  19. #0 {main}
  20. thrown in %sdestructor_visibility_001.php on line %d