|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-07-10 14:32 UTC] helly@php.net
[2005-05-02 11:47 UTC] andrey@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 13:00:02 2025 UTC |
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