ID: 33459 User updated by: james at safesearching dot com Reported By: james at safesearching dot com Status: Open -Bug Type: Dynamic loading +Bug Type: Zend Engine 2 problem Operating System: redhat 7.3 PHP Version: 5.0.4 New Comment:
changing category Previous Comments: ------------------------------------------------------------------------ [2005-06-24 05:37:07] james at safesearching dot com Description: ------------ The default behaviour of class_exists calling __autoload breaks BC for end user scripts which rely on other code outside that users control (ie PEAR classes). Many PEAR classes such as Calendar and DB_DataObject use class_exists to load other classes... Simply adding an __autoload function to a script using these classes generates a Fatal error. An option was added to allow a class_exists($name, FALSE) call to prevent an __autoload call... but as end users don't have control over things like PEAR classes, this isn't a viable fix to bug #28333. Perhaps more reasonably, class_exists should not call __autoload by default so as to maintain BC... and allow users to explicity request that behaviour with a second parameter of TRUE. Reproduce code: --------------- require_once('Calendar/Calendar.php'); $cal = new Calendar(); function __autoload($name) { require_once($name); } Expected result: ---------------- Expect no output (ie no errors). Actual result: -------------- Warning: __autoload(Calendar_Engine_UnixTS): failed to open stream: No such file or directory in /home/james/test.php on line 8 Fatal error: __autoload(): Failed opening required 'Calendar_Engine_UnixTS' (include_path='.:/usr/local/lib/php') in /home/test.php on line 8 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33459&edit=1