Return to bug34045.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests |
1.1 ! misho 1: --TEST-- ! 2: Bug #34045 (Buffer overflow with serialized object) ! 3: --FILE-- ! 4: <?php ! 5: class BasicSingleton ! 6: { ! 7: private static $instance; ! 8: ! 9: public function __wakeup() { ! 10: self::$instance = $this; ! 11: } ! 12: ! 13: public static function singleton() { ! 14: if (!(self::$instance instanceof BasicSingleton)) { ! 15: $c = __CLASS__; ! 16: self::$instance = new $c; ! 17: } ! 18: return self::$instance; ! 19: } ! 20: } ! 21: ! 22: $db = BasicSingleton::singleton(); ! 23: $db_str = serialize($db); ! 24: $db2 = unserialize($db_str); ! 25: echo "ok\n"; ! 26: ?> ! 27: --EXPECT-- ! 28: ok