From:             christian dot kaps at imaxx21 dot com
Operating system: Ubuntu 7.04 Server
PHP version:      5.2.1
PHP Bug Type:     Reproducible crash
Bug description:  Segmentation fault with ArrayAccess, set_error_handler and 
undefined var

Description:
------------
I get the message 'child pid 13149 exit signal Segmentation fault (11)' in
my apache logs. The problem occurs when i use the following code.



Reproduce code:
---------------
<?php

class env
{
        public function __construct()
        {
                set_error_handler(array(__CLASS__, 'errorHandler'));
        }
        
        public static function errorHandler($errno, $errstr, $errfile, $errline)
        {
                throw new ErrorException($errstr, 0, $errno, $errfile, 
$errline); 
        }
}

class cache implements ArrayAccess
{
        private $container = array();
        
        public function offsetGet($id) {}
        
        public function offsetSet($id, $value) {}
        
        public function offsetUnset($id) {}
        
        public function offsetExists($id)
        {
                return isset($this->containers[(string) $id]);
        }
}

$env = new env();
$cache = new cache();
var_dump(isset($cache[$id]));

?>

Expected result:
----------------
Fatal error: Uncaught exception 'ErrorException' with message 'Undefined
variable: id' 

Actual result:
--------------
child pid 13149 exit signal Segmentation fault (11) in error.log

-- 
Edit bug report at http://bugs.php.net/?id=41209&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41209&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41209&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41209&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41209&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41209&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41209&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41209&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41209&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41209&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41209&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41209&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41209&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41209&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41209&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41209&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41209&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41209&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41209&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41209&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41209&r=mysqlcfg

Reply via email to