#34216 [Opn->Asn]: Segfault with autoload
| From: | sebastian@php.net | Date: | Tue, 23 Aug 2005 05:28:09 +0000 |
| Subject: | #34216 [Opn->Asn]: Segfault with autoload | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-83891@lists.php.net to get a copy of this message | ||
ID: 34216
Updated by: sebastian@php.net
Reported By: sebastian@php.net
-Status: Open
+Status: Assigned
Bug Type: SPL related
Operating System: Linux
PHP Version: 5.1.0RC1
-Assigned To:
+Assigned To: helly
Previous Comments:
------------------------------------------------------------------------
[2005-08-23 07:27:09] sebastian@php.net
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 this bug report at http://bugs.php.net/?id=34216&edit=1