RE: [PHP-DEV] Re: [Zend Engine 2] RE: [PHP-DEV] REPOST: Class Autoloading [PATCH]
| From: | Andi Gutmans | Date: | Fri, 16 Aug 2002 16:03:40 +0000 |
| Subject: | RE: [PHP-DEV] Re: [Zend Engine 2] RE: [PHP-DEV] REPOST: Class Autoloading [PATCH] | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-86910@lists.php.net to get a copy of this message | ||
At 06:24 PM 8/7/2002 +0200, phpsurf wrote:
Hi I'm testing this great feature ... but unfortunately, it lokos like it doesn't work for extended classes either ! in brad's example (in the history of this mail) you cannot remove the include_once statements in the children classes (I would rather replace them with the apropriate call to the __autoload function) the class MyFoo extends Foo when you try to instantiate Foo, __autoload works perfectly. but when you try to instantiate MyFoo, it fails with the following message: "Fatal error: Class myfoo: Cannot inherit from undefined class foo in c:\webroot\ze2\myfoo.php on line 2" andi ? is it not supposed to work either with extended classes ?Can you please send me a very short script which reproduces your problem? Thanks, Andi
-----Original Message----- From: Andi Gutmans [mailto:andi@zend.com] Sent: mercredi 26 juin 2002 21:02 To: Brad LaFountain; Ivan Ristic; phpsurf Cc: php-dev@lists.php.net; engine2@lists.zend.com Subject: Re: [PHP-DEV] Re: [Zend Engine 2] RE: [PHP-DEV] REPOST: Class Autoloading [PATCH] Hey, What I meant was nested classes, my bad :) I meant it won't work for Foo::Bar::Barbara but only for class Foo. Andi At 11:56 AM 6/26/2002 -0700, Brad LaFountain wrote:sub-classes is I ALWAYS- will never work for sub-classes so don't even ask!!!!!Andi, This doesn't need to be an issue. The way that I useinclude_once("subclass.php"); at the top of each superclass file. I know everyone doesn't code the same way but maybe you can have thatas a suggestionto people who use __autoload. Foo.php class Foo{} Bar.php class Bar{} MyFoo.php include_once("Foo.php"); class MyFoo extends Foo{} MyBar.php include_once("Bar.php"); class MyBar extends Bar{} auto_test.php <? function __autoload($name) { include_once("$name.php"); } $f = new MyFoo(); $b = new MyBar(); ?> - brad-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php ______________________________________________________________________________ i (france), c'est aussi une gamme complète de PC en exclusivité avec DELL http://www.ifrance.com/_reloc/signedellAt 11:27 PM 6/11/2002 +0100, Ivan Ristic wrote:__________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.phpOkay, I guess I can live with it :) AndiIs there anyone else who would like to comment on the patch? http://www.webkreator.com/download/class_autoload.patch Or can we have it committed? -- Ivan Ristic, ivanr@webkreator.com [ Weblog on PHP, Software development, Intranets, and Knowledge Management: http://www.webkreator.com ] -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php