Bug #68709 [Fbk->NoF]: Segfault when parent::offsetGet() is called

From: Date: Sun, 18 Jan 2015 04:22:30 +0000
Subject: Bug #68709 [Fbk->NoF]: Segfault when parent::offsetGet() is called
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190025@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68709&edit=1 ID: 68709 Updated by: php-bugs@lists.php.net Reported by: zecho23 at gmail dot com Summary: Segfault when parent::offsetGet() is called -Status: Feedback +Status: No Feedback Type: Bug Package: Reproducible crash Operating System: Debian 8 PHP Version: 5.6.4 Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2015-01-10 16:17:44] laruence@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2015-01-01 12:38:52] zecho23 at gmail dot com Description: ------------ I had some old code running for years (since PHP 5.3.x). After upgrade it started to segfault in a overwritten offsetGet method in a class implementing ArrayAccess. After debugging it I reached the broken code at following function made long ago: public function offsetGet($key) { if (in_array($key, array_keys($this->_structure), true) && !isset($this[$key])) { return null; } return (parent::offsetExists($key)) ? parent::offsetGet($key) : null; } The result at dbg: Program received signal SIGSEGV, Segmentation fault. zend_call_method (object_pp=object_pp@entry=0x7fffff7ff078, obj_ce=0x1d14658, fn_proxy=fn_proxy@entry=0x1d5beb0, function_name=function_name@entry=0xb2598c "offsetGet", function_name_len=function_name_len@entry=9, retval_ptr_ptr=retval_ptr_ptr@entry=0x7fffff7ff088, param_count=1, arg1=0x2059d28, arg2=0x0) at /build/php5-NIujy4/php5-5.6.4+dfsg/Zend/zend_interfaces.c:47 47 in /build/php5-NIujy4/php5-5.6.4+dfsg/Zend/zend_interfaces.c I made it work after changing the last tine to: return (parent::offsetExists($key)) ? $this->_structure[$key] : null; Hope that helps. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68709&edit=1

« previous php.bugs (#190025) next »