From:             Jason at AMP-design dot net
Operating system: Windows 2003 / CentOS 3
PHP version:      5.0.3
PHP Bug Type:     Reproducible crash
Bug description:  Crash when exceptions thrown from ArrayAccess::offsetUnset()

Description:
------------
This crashes both on PHP 5.0.3 on Windows 2003 / Apache 2.0.52 and Centos
3 (Redhat Entperise Linux 3 for cheapskates) with Apache 2.0.48 and PHP
5.0.2

This occurs due to the Exception thrown. Removing the exception will
prevent the crash.

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

header('Content-type: text/plain');
class FooBar implements ArrayAccess {
        private $array = array();

        public function offsetExists($index) {
                return isset($this->array[$index]);
        }

        public function offsetGet($index) {
                return $this->array[$index];
        }

        public function offsetSet($index, $value) {
                $this->array[$index] = $value;
        }

        public function offsetUnset($index) {
                throw new Exception('Just try and make me crash ya sucker ;-)');
                unset($this->array[$index]);
        }

}

$i = 0;
$foo = new FooBar();
$foo[$i] = $i++;
$foo[$i] = $i++;
$foo[$i] = $i++;
unset($foo[1]);

print_R($foo);
?>

Expected result:
----------------
$foo would dump out it's array elements which should be 0 and 2

Actual result:
--------------
Apache crash (exists with Parent: child process exited with status
3221225477 -- Restarting on Windows Apache 2 log, dunno about Linux, can't
be faffed to mess about in SSH, however I do not get a HTTP reponse, and
therefore I assume it segfaults)

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

Reply via email to