#34260 [Opn->Fbk]: Segfault with callbacks (array_map) + overloading
| From: | derick@php.net | Date: | Fri, 26 Aug 2005 06:57:30 +0000 |
| Subject: | #34260 [Opn->Fbk]: Segfault with callbacks (array_map) + overloading | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-84013@lists.php.net to get a copy of this message | ||
ID: 34260
Updated by: derick@php.net
Reported By: etnu at etnu dot org
-Status: Open
+Status: Feedback
Bug Type: Class/Object related
Operating System: Debian 3.1 (Sarge)
PHP Version: 5CVS-2005-08-25 (snap)
New Comment:
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php
Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2005-08-25 22:03:06] etnu at etnu dot org
Description:
------------
A segfault occurs when using callbacks to functions that get triggered
via __call.
In the case of what's actually being called, the class is derived from
mysqli.
I haven't done extensive testing, but I was getting segfaults with both
array_map and array_filter. It seems to be a general callback-related
issue.
Dual Opteron
Kernel is SMP + 64bit
Configure:
./configure \
--with-pgsql \
--with-xmlrpc \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql=/usr --with-mysqli=/usr/bin/mysql_config \
--prefix=/usr/local/apache2/php \
--with-config-file-path=/usr/local/apache2/php \
--enable-force-cgi-redirect \
--disable-magic-quotes \
--with-curl \
--with-gd --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib
--with-freetype-dir=/usr/lib --with-zlib-dir=/usr/lib
Reproduce code:
---------------
<?php
class Faulty
{
function __call($Method,$Args)
{
switch($Method)
{
case 'seg':
echo "I hate me";
break;
}
}
function NormalMethod($Args)
{
echo "I heart me";
}
}
$Faulty = new Faulty();
$Array = array('Some junk','Some other junk');
// This causes a seg fault.
$Failure = array_map(array($Faulty,'seg'),$Array);
// This does not.
$Failure = array_map(array($Faulty,'NormalMethod'),$Array);
?>
Expected result:
----------------
Not seg faulting.
Actual result:
--------------
Segfaulting.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34260&edit=1