File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / Zend / tests / bug41209.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 #41209 (Segmentation fault with ArrayAccess, set_error_handler and undefined var)
    3: --FILE--
    4: <?php
    5: 
    6: class env
    7: {
    8:     public function __construct()
    9:     {
   10:         set_error_handler(array(__CLASS__, 'errorHandler'));
   11:     }
   12: 
   13:     public static function errorHandler($errno, $errstr, $errfile, $errline)
   14:     {
   15:         throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
   16:     }
   17: }
   18: 
   19: class cache implements ArrayAccess
   20: {
   21:     private $container = array();
   22: 
   23:     public function offsetGet($id) {}
   24: 
   25:     public function offsetSet($id, $value) {}
   26: 
   27:     public function offsetUnset($id) {}
   28: 
   29:     public function offsetExists($id)
   30:     {
   31:         return isset($this->containers[(string) $id]);
   32:     }
   33: }
   34: 
   35: $env = new env();
   36: $cache = new cache();
   37: var_dump(isset($cache[$id]));
   38: 
   39: echo "Done\n";
   40: ?>
   41: --EXPECTF--	
   42: Fatal error: Uncaught exception 'ErrorException' with message 'Undefined variable: id' in %s:%d
   43: Stack trace:
   44: #0 %s(%d): env::errorHandler(8, '%s', '%s', 34, Array)
   45: #1 {main}
   46:   thrown in %s on line %d

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