From: etnu at etnu dot org
Operating system: Debian 3.1 (Sarge)
PHP version: 5CVS-2005-08-25 (snap)
PHP Bug Type: Class/Object related
Bug description: Segfault with callbacks (array_map) + overloading
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 bug report at http://bugs.php.net/?id=34260&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34260&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34260&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34260&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34260&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34260&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34260&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34260&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34260&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34260&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34260&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34260&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34260&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34260&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34260&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34260&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34260&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34260&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34260&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34260&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34260&r=mysqlcfg