bug39721.phpt 441 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Bug #39721 (Runtime inheritance causes data corruption)
  3. --FILE--
  4. <?php
  5. class test2 {
  6. private static $instances = 0;
  7. public $instance;
  8. public function __construct() {
  9. $this->instance = ++self::$instances;
  10. }
  11. }
  12. $foo = new test2();
  13. if (is_object($foo)) {
  14. class test2_child extends test2 {
  15. }
  16. }
  17. $child = new test2_child();
  18. echo $foo->instance . "\n";
  19. echo $child->instance . "\n";
  20. ?>
  21. --EXPECT--
  22. 1
  23. 2