mirror of
https://github.com/php/php-src.git
synced 2024-12-18 06:21:41 +08:00
29 lines
541 B
Plaintext
29 lines
541 B
Plaintext
|
--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
|