Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15153 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55753 invoked by uid 1010); 22 Feb 2005 19:59:32 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 55737 invoked from network); 22 Feb 2005 19:59:32 -0000 Received: from unknown (HELO php-tools.net) (127.0.0.1) by localhost with SMTP; 22 Feb 2005 19:59:32 -0000 X-Host-Fingerprint: 217.160.167.162 a15162455.alturo-server.de Linux 2.6 Received: from ([217.160.167.162:51663] helo=mail.rot3.de) by pb1.pair.com (ecelerity HEAD r(5097)) with SMTP id 4E/DF-08154-32F8B124 for ; Tue, 22 Feb 2005 14:59:31 -0500 Received: from [192.168.0.54] (pD9E395A7.dip.t-dialin.net [217.227.149.167]) by mail.rot3.de (Postfix) with ESMTP id 39CBA80AB13 for ; Tue, 22 Feb 2005 20:59:28 +0100 (CET) Message-ID: <421B8F1F.1060407@php-tools.net> Date: Tue, 22 Feb 2005 20:59:27 +0100 Organization: PHP Application Tools User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en MIME-Version: 1.0 To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: __autoload() and class_exists() From: schst@php-tools.net (Stephan Schmidt) 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