ctor_dtor.phpt 717 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. --TEST--
  2. ZE2 The new constructor/destructor is called
  3. --SKIPIF--
  4. <?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
  5. --FILE--
  6. <?php
  7. class early {
  8. function early() {
  9. echo __CLASS__ . "::" . __FUNCTION__ . "\n";
  10. }
  11. function __destruct() {
  12. echo __CLASS__ . "::" . __FUNCTION__ . "\n";
  13. }
  14. }
  15. class late {
  16. function __construct() {
  17. echo __CLASS__ . "::" . __FUNCTION__ . "\n";
  18. }
  19. function __destruct() {
  20. echo __CLASS__ . "::" . __FUNCTION__ . "\n";
  21. }
  22. }
  23. $t = new early();
  24. $t->early();
  25. unset($t);
  26. $t = new late();
  27. //unset($t); delay to end of script
  28. echo "Done\n";
  29. ?>
  30. --EXPECTF--
  31. early::early
  32. early::early
  33. early::__destruct
  34. late::__construct
  35. Done
  36. late::__destruct