From: jasbarne at indiana dot edu Operating system: Any PHP version: 5.0.0RC3 PHP Bug Type: Feature/Change Request Bug description: stack of __autoload handlers
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 bug report at http://bugs.php.net/?id=29072&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29072&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29072&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29072&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29072&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29072&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29072&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29072&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29072&r=support Expected behavior: http://bugs.php.net/fix.php?id=29072&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29072&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29072&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29072&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29072&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29072&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29072&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29072&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29072&r=float