__autoload() and class_exists()

From: Date: Tue, 22 Feb 2005 19:59:27 +0000
Subject: __autoload() and class_exists()
Groups: php.internals 
Request: Send a blank email to internals+get-15153@lists.php.net to get a copy of this message
Hi, I just found this strange behaviour in PHP5: When using class_exists() to test, whether a class exists, the magic function __autoload() is called: function __autoload($class) { echo "Trying to load $class\n"; } if (!class_exists('DB')) { echo "DB does not exist.\n"; } You'll get: Trying to load DB DB does not exist. Is this a bug or the desired behaviour? It's pretty annoying, when you are trying to use __autoload() as a fallback if a class could not be loaded from directories defined by the user... Best regards, Stephan -- http://www.php-tools.net http://www.schst.net http://pear.php.net

« previous php.internals (#15153) next »