bug32852.phpt 1.04 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
--TEST--
Bug #32852 (Crash with singleton and __destruct when zend.ze1_compatibility_mode = On)
--INI--
zend.ze1_compatibility_mode=on
error_reporting=4095
--FILE--
<?php
class crashme {
    private static $instance = null;

    public function __construct() {
        self::$instance = $this;
    }

    public function __destruct() {
        echo "i'm called\n";
    }

    public static function singleton() {
        if (!isset(self::$instance)) {
            self::$instance = new crashme();
        }
        return self::$instance;
    }
}

crashme::singleton();
?>
--EXPECTF--
Strict Standards: Implicit cloning object of class 'crashme' because of 'zend.ze1_compatibility_mode' in %sbug32852.php on line 6
i'm called

Strict Standards: Implicit cloning object of class 'crashme' because of 'zend.ze1_compatibility_mode' in %sbug32852.php on line 15
i'm called

Strict Standards: Implicit cloning object of class 'crashme' because of 'zend.ze1_compatibility_mode' in %sbug32852.php on line 17
i'm called
i'm called