1--TEST-- 2Bug #41209 (Segmentation fault with ArrayAccess, set_error_handler and undefined var) 3--FILE-- 4<?php 5 6class 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 19class 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(); 37var_dump(isset($cache[$id])); 38 39echo "Done\n"; 40?> 41--EXPECTF-- 42Fatal error: Uncaught ErrorException: Undefined variable: id in %s:%d 43Stack trace: 44#0 %s(%d): env::errorHandler(8, '%s', '%s', 34, Array) 45#1 {main} 46 thrown in %s on line %d 47