#32252 [NEW]: Segfault when offsetSet throws an Exception (only without debug)
| From: | shulmanb at il dot ibm dot com | Date: | Wed, 09 Mar 2005 13:38:41 +0000 |
| Subject: | #32252 [NEW]: Segfault when offsetSet throws an Exception (only without debug) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-75166@lists.php.net to get a copy of this message | ||
From: shulmanb at il dot ibm dot com
Operating system: Windows XP
PHP version: 5CVS-2005-03-09 (dev)
PHP Bug Type: Zend Engine 2 problem
Bug description: Segfault when offsetSet throws an Exception (only without debug)
Description:
------------
In some cases, when offsetSet throws an exception a segfault occurs.
This does not happen when compiled with --enable-debug.
Note that if the index passed to $list is positive or a string, not
segfault occurs.
Reproduce code:
---------------
class a implements ArrayAccess
{
function offsetExists ($offset) { return false; }
function offsetGet ($offset) { return null; }
function offsetSet ($offset, $value) { throw new Exception ("Ooops"); }
function offsetUnset ($offset) {}
}
function test()
{
$list = new a();
try {
$list[-1] = 123;
} catch (Exception $e) { }
return true;
}
print test();
Expected result:
----------------
The output should be "1".
Actual result:
--------------
Segmentation fault.
The stack trace reported in Visual Studio, using the latest snapshot and
debug pack is:
php5ts.dll!shutdown_memory_manager(int silent=0, int full_shutdown=0, void
* * * tsrm_ls=0x00364b38) Line 490 + 0xb C
php5ts.dll!php_request_shutdown(void * dummy=0x00000000) Line 1225 +
0x2f C
msvcrt.dll!77c37bbe()
user32.dll!77d5f160()
--
Edit bug report at http://bugs.php.net/?id=32252&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32252&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32252&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32252&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32252&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32252&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32252&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32252&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32252&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32252&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32252&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=32252&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=32252&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32252&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32252&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32252&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32252&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32252&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32252&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32252&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32252&r=mysqlcfg