From: small at cybertronic dot com
Operating system: Linux
PHP version: 5.1.2
PHP Bug Type: SPL related
Bug description: Exceptions thrown in ArrayObject::offsetGet cause segfault
Description:
------------
Throwing exceptions in an overloaded offsetGet() functions seems to cause
segfaults in PHP 5.1.2.
Reproduce code:
---------------
<?php
class foo extends ArrayObject {
public function __construct($obj, $flags = 0, $iterator_class =
"ArrayIterator") {
}
public function offsetGet($key) {
throw new Exception("hi");
}
}
$test=new foo();
try{
$a=$test['bar'];
} catch (Exception $e) {
echo "got exception";
}
?>
Expected result:
----------------
I expect the output:
got exception
Actual result:
--------------
I get a segfault, with backtrace as follows:
#0 0x081cb2cd in spl_array_read_dimension_ex ()
#1 0x081cb35f in spl_array_read_dimension ()
#2 0x08309d27 in zend_fetch_dimension_address ()
#3 0x0833d89e in ZEND_FETCH_DIM_R_SPEC_CV_CONST_HANDLER ()
#4 0x0830a386 in execute ()
#5 0x082ed585 in zend_execute_scripts ()
#6 0x082a917e in php_execute_script ()
#7 0x0835039d in main ()
--
Edit bug report at http://bugs.php.net/?id=36825&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=36825&r=trysnapshot44
Try a CVS snapshot (PHP 5.1):
http://bugs.php.net/fix.php?id=36825&r=trysnapshot51
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=36825&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36825&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=36825&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36825&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36825&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36825&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36825&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36825&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=36825&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=36825&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36825&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36825&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36825&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36825&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36825&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36825&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36825&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36825&r=mysqlcfg