#28333 [NEW]: class_exists call __autoload

From: Date: Sun, 09 May 2004 06:22:52 +0000
Subject: #28333 [NEW]: class_exists call __autoload
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-59408@lists.php.net to get a copy of this message
From: e_corge at yahoo dot fr Operating system: Windows XP Pro PHP version: 5CVS-2004-05-09 (dev) PHP Bug Type: Zend Engine 2 problem Bug description: class_exists call __autoload 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 bug report at http://bugs.php.net/?id=28333&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28333&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28333&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=28333&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=28333&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=28333&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=28333&r=needscript Try newer version: http://bugs.php.net/fix.php?id=28333&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=28333&r=support Expected behavior: http://bugs.php.net/fix.php?id=28333&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=28333&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=28333&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=28333&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28333&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=28333&r=dst IIS Stability: http://bugs.php.net/fix.php?id=28333&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=28333&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=28333&r=float

« previous php.bugs (#59408) next »