ID:               26697
 Comment by:       davidc at blesys dot com
 Reported By:      arjen at glas dot its dot tudelft dot nl
 Status:           Open
 Bug Type:         Zend Engine 2 problem
 Operating System: Linux
 PHP Version:      5CVS-2003-12-22 (dev)
 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------

[2003-12-22 16:03:57] 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();

?>



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=26697&edit=1

Reply via email to