Segfault with spl_autoload

From: Date: Tue, 16 Aug 2005 10:33:53 +0000
Subject: Segfault with spl_autoload
Groups: php.internals 
Request: Send a blank email to internals+get-18163@lists.php.net to get a copy of this message
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: 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'); 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 -- Sebastian Bergmann http://www.sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

« previous php.internals (#18163) next »