Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:15463 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82129 invoked by uid 1010); 16 Mar 2005 09:18:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 82114 invoked by uid 1007); 16 Mar 2005 09:18:24 -0000 Message-ID: <20050316091824.82113.qmail@lists.php.net> To: internals@lists.php.net Date: Wed, 16 Mar 2005 10:16:16 +0100 References: <20050316085836.76914.qmail@lists.php.net> Lines: 34 User-Agent: KNode/0.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8Bit X-Posted-By: 62.138.229.210 Subject: Re: __autoload() From: johannes@php.net (Johannes Schlueter) Hi Lukas, Lukas Smith wrote: > Hi, > > would it be possible to allow people to override the fixed name of > __autoload() to a user defined function (static method?). I think this > would be much more flexible and would probably also make it easier to > exploit __autoload() inside class libraries. Especially as users are > likely to use code from different class libraries. > > Seems like a nice little addition for PHP 5.1 ... Marcus recently added autoload stuff to SPL. I didn't test it, yet. But for what i have seen he ads an stack of autoload functions where you can register your own function with spl_autoload_register() there you should also be able to enter some method (in array($object, 'method') oder array('class', 'method') syntax. The functions in this stack are called one after the other. Additionally he adds an standard autoload function which searchs for a file $class.$extension in the includepath where $extension is by default inc or .inc.php where you can register your own extension using spl_autoload_extensions() Everything mainly from looking at the implementation and by taking a look at Marcus' tests located at ext/spl/tests/spl_autoload_001.phpt and spl_autoload_002.phpt hope someone corrects my failures ;-) johannes -- Johannes Schlüter Mayflower GmbH / ThinkPHP http://thinkphp.de http://blog.thinkphp.de