File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug34045.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (13 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

    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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>