#41209 [Opn->Csd]: Segmentation fault with ArrayAccess, set_error_handler and undefined var
| From: | tony2001@php.net | Date: | Sat, 28 Apr 2007 08:54:43 +0000 |
| Subject: | #41209 [Opn->Csd]: Segmentation fault with ArrayAccess, set_error_handler and undefined var | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-112022@lists.php.net to get a copy of this message | ||
ID: 41209
Updated by: tony2001@php.net
Reported By: christian dot kaps at imaxx21 dot com
-Status: Open
+Status: Closed
Bug Type: Reproducible crash
Operating System: Ubuntu 7.04 Server
PHP Version: 5.2.1
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
I've fixed an invalid read in CVS, so you should not be able to
reproduce it with the snapshots.
Previous Comments:
------------------------------------------------------------------------
[2007-04-28 08:50:34] christian dot kaps at imaxx21 dot com
I have it tested on my gentoo box at home and the error doesn`t occour.
It is probably a ubuntu problem!?
Next time when is submit a bug I will first try it at home (o;
------------------------------------------------------------------------
[2007-04-27 07:33:32] johannes@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
I can\'t reproduce it.
Please add a gdb backtrace in case you can reproduce it.
------------------------------------------------------------------------
[2007-04-27 07:23:16] christian dot kaps at imaxx21 dot com
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 this bug report at http://bugs.php.net/?id=41209&edit=1