ID: 28333 Updated by: [EMAIL PROTECTED] Reported By: e_corge at yahoo dot fr -Status: Closed +Status: Open -Bug Type: Zend Engine 2 problem +Bug Type: Documentation problem Operating System: * PHP Version: 5.0RC2 New Comment:
this needs to be added to documentation bool class_exists(string classname, [bool autoload]) Previous Comments: ------------------------------------------------------------------------ [2004-05-09 13:02:27] [EMAIL PROTECTED] Head version supports a second parameter for excatly that reason. If that parameter is 'false' then no __autoload is being called. ------------------------------------------------------------------------ [2004-05-09 13:01:19] [EMAIL PROTECTED] 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. ------------------------------------------------------------------------ [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
