File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug64720.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Jul 22 01:32:17 2013 UTC (11 years, 8 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17, HEAD
5.4.17

    1: --TEST--
    2: Bug #64720 (SegFault on zend_deactivate)
    3: --FILE--
    4: <?php
    5: class Stat {
    6:     private static $requests;
    7:     public static function getInstance() {
    8:         if (!isset(self::$requests[1])) {
    9:             self::$requests[1] = new self();
   10:         }
   11:         return self::$requests[1];
   12:     }
   13:     
   14:     public function __destruct() {
   15:         unset(self::$requests[1]);
   16:     }
   17: }
   18: 
   19: class Foo {
   20:     public function __construct() {
   21:         Stat::getInstance();
   22:     }
   23: }
   24: 
   25: class Error {
   26:     private $trace;
   27:     public function __construct() {
   28:         $this->trace = debug_backtrace(1);
   29:     }
   30: }
   31: 
   32: class Bar {
   33:     public function __destruct() {
   34:         Stat::getInstance();
   35:         new Error();
   36:     }
   37: 
   38:     public function test() {
   39:         new Error();
   40:     }
   41: }
   42: 
   43: $foo = new Foo();
   44: $bar = new Bar();
   45: $bar->test();
   46: ?>
   47: --EXPECTF--
   48: Fatal error: Access to undeclared static property: Stat::$requests in %sbug64720.php on line 12

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