summaryrefslogtreecommitdiff
path: root/Zend/tests/bug34045.phpt
blob: 61886cf354b674c42c997c037d4ff8cb38a6a324 (plain)
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
--TEST--
Bug #34045 (Buffer overflow with serialized object)
--FILE--
<?php
class BasicSingleton
{
    private static $instance;

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

    public static function singleton() {
        if (!(self::$instance instanceof BasicSingleton)) {
            $c = __CLASS__;
            self::$instance = new $c;
        }
        return self::$instance;
    }
}

$db = BasicSingleton::singleton();
$db_str = serialize($db);
$db2 = unserialize($db_str);
echo "ok\n";
?>
--EXPECT--
ok