ID: 29072 Updated by: [EMAIL PROTECTED] Reported By: jasbarne at indiana dot edu Status: Open Bug Type: Feature/Change Request -Operating System: Any +Operating System: * -PHP Version: 5.0.0RC3 +PHP Version: 5.0 New Comment:
That occured to me also. But we cannot do anything before 5.0. Until then you probably need a master __autoload included by auto_prepend_file ini setting. This one would need to handle an array of handlers....in the other files you'd need to register your functions. Previous Comments: ------------------------------------------------------------------------ [2004-07-09 09:26:46] jasbarne at indiana dot edu Description: ------------ I'm using the __autoload function to load my package's files. However, if I use another package and that has also implemented __autoload then PHP barfs Would it be possible to create a stack of __autoload functions? As an alternative, perhaps we could link __autoload methods to class definitions, and then check class definitions for __autoload functions whenever a class is not found. Reproduce code: --------------- <?php // Test1.php function __autoload() {} ?> <?php //Test2.php include_once 'Test1.php'; function __autoload() {} ?> Expected result: ---------------- When user tries to instanciate undefined classes the engine checks all __autoload() functions to try to load the class file. Actual result: -------------- Fatal error: Cannot redeclare __autoload() (previously declared in C:\Apache\Apache2\htdocs\DomTools\test.php:5) in C:\Apache\Apache2\htdocs\DomTools\autoload.php on line 7 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29072&edit=1