#34216 [Asn->Fbk]: Segfault with autoload
| From: | tony2001@php.net | Date: | Tue, 20 Sep 2005 12:56:28 +0000 |
| Subject: | #34216 [Asn->Fbk]: Segfault with autoload | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-85283@lists.php.net to get a copy of this message | ||
ID: 34216
Updated by: tony2001@php.net
Reported By: sebastian@php.net
-Status: Assigned
+Status: Feedback
Bug Type: SPL related
Operating System: Linux
PHP Version: 5.1.0RC1
Assigned To: helly
New Comment:
Sebastian, I'd appreciate if you provide a complete reproduce case
(doesn't matter which size it is).
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