From: [EMAIL PROTECTED]
Operating system: Linux
PHP version: 5.1.0RC1
PHP Bug Type: SPL related
Bug description: Segfault with autoload
Description:
------------
I am experiencing a segfault with spl_autoload in the
PHP_5_1 branch with the upcoming PHPUnit 2.3.0.
The nature of PHPUnit's complexity makes it almost
impossible for me to come up with a simple, reproducing
script (I already invested hours into this, to no avail so
far).
It is weird that the segfault only occurs in one out of
two common code paths of PHPUnit's TextUI test runner.
Furthermore, small code changes (see below) seem to make
the problem go away:
Reproduce code:
---------------
Segfault:
function PHPUnit2_Util_Classloader($className) {
print "Loading $className.\n";
if (strpos($className, 'PHPUnit2_') !== FALSE) {
@include(str_replace('_', '/', $className) . '.php');
}
}
spl_autoload_register('PHPUnit2_Util_Classloader');
Segfault:
function PHPUnit2_Util_Classloader($className) {
$bt = debug_backtrace();
print "Loading $className.\n";
if (strpos($className, 'PHPUnit2_') !== FALSE) {
@include(str_replace('_', '/', $className) . '.php');
}
}
spl_autoload_register('PHPUnit2_Util_Classloader');
No Segfault:
function PHPUnit2_Util_Classloader($className) {
$bt = debug_backtrace();
print_r($bt[1]);
print "Loading $className.\n";
if (strpos($className, 'PHPUnit2_') !== FALSE) {
@include(str_replace('_', '/', $className) . '.php');
}
}
spl_autoload_register('PHPUnit2_Util_Classloader');
Actual result:
--------------
Below are the links to the results of GDB and Valgrind.
Interestingly, when run through GDB it segfaults, when run
through Valgrind it does not segfault.
GDB:
http://www.sebastian-bergmann.de/stuff/phpunit2-gdb.txt
Valgrind:
http://www.sebastian-bergmann.de/stuff/phpunit2-valgrind.txt
--
Edit bug report at http://bugs.php.net/?id=34216&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34216&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=34216&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=34216&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34216&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34216&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34216&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34216&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34216&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34216&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34216&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=34216&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=34216&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34216&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34216&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34216&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34216&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34216&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34216&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34216&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34216&r=mysqlcfg