#28333 [Opn->Csd]: class_exists call __autoload
| From: | helly@php.net | Date: | Sun, 09 May 2004 11:01:20 +0000 |
| Subject: | #28333 [Opn->Csd]: class_exists call __autoload | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-59415@lists.php.net to get a copy of this message | ||
ID: 28333
Updated by: helly@php.net
Reported By: e_corge at yahoo dot fr
-Status: Open
+Status: Closed
Bug Type: Zend Engine 2 problem
Operating System: Windows XP Pro
PHP Version: 5CVS-2004-05-09 (dev)
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2004-05-09 08:22:50] e_corge at yahoo dot fr
Description:
------------
I've a function __autoload in my script. I want to use class_exists to
determine if a class definition has been included but i don't want to
load it.
However, class_exists call __autoload systematically when a class
definition hasn't been loaded.
This problem poses problems of compatibility with previous versions.
Indeed, many scripts used this function before using a include.
Reproduce code:
---------------
function __autoload($classname) {
echo 'i want to load ['.$classname.']<br>';
}
class A {}
if (class_exists('B') == false)
echo "Class B don't exist !<br>";
else
echo "Class B exist !<br>";
if (class_exists('A') == false)
echo "Class A don't exist !<br>";
else
echo "Class A exist !<br>";
Expected result:
----------------
Class B don't exist !
Class A exist !
Actual result:
--------------
i want to load [B]
Class B don't exist !
Class A exist !
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28333&edit=1