|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-12-22 16:03 UTC] arjen at glas dot its dot tudelft dot nl
Description: ------------ When calling class_exists on a nonexistent classname in __autoload, you'll get a segfault. This is in beta1, beta2 and beta3 (and now I had the time to create a testcase and do a report). Which ran under apache2 (2.0.48) on gentoo linux. And then I saw this report: http://bugs.php.net/bug.php?id=26630&edit=2 So I downloaded the php5-200312222030 snapshot and there it also segfaults... Reproduce code: --------------- <? function __autoload($classname) { if(!class_exists('test')) { echo "This won't be reached due to a segfault"; } } $test = new test(); ?> PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 02:00:01 2025 UTC |
What happens, I think, is that __autoload starts recursing endlessly. Do this: $autotracker=false; function __autoload ($n) { global $autotracker; $n=strtolower($n); if ($autotracker==$n)die("Attempting to autoload $n again"); $autotracker=$n; ....//rest of function __autoload }//end __autoload Probably a bug, but rather easy to fix by the client programmer. I think the bug I found today w/ thrown exceptions is much more dangerous (http://bugs.php.net/bug.php?id=26698) because you can't really fix it for all cases.