Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:8513 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42122 invoked by uid 1010); 14 Mar 2004 17:31:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 42077 invoked from network); 14 Mar 2004 17:31:38 -0000 Received: from unknown (HELO mail.zend.com) (192.117.235.230) by pb1.pair.com with SMTP; 14 Mar 2004 17:31:38 -0000 Received: (qmail 27204 invoked from network); 14 Mar 2004 17:31:35 -0000 Received: from guardian.zend.office (HELO AndiNotebook.zend.com) (10.1.1.4) by mail.zend.com with SMTP; 14 Mar 2004 17:31:35 -0000 Message-ID: <5.1.0.14.2.20040314193029.015f35e0@127.0.0.1> X-Sender: andi@127.0.0.1 X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Sun, 14 Mar 2004 19:31:33 +0200 To: "Jeffrey Moss" , In-Reply-To: <001101c40569$edd10520$2c02a8c0@hans> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] getInstance and new self() From: andi@zend.com (Andi Gutmans) References: <001101c40569$edd10520$2c02a8c0@hans> self:: is always evaluated at compile-time and refers to the class it is defined in and not the concrete object/class. Andi At 05:03 PM 3/8/2004 -0700, Jeffrey Moss wrote: >I found this on a zend engine 2 list archive, but didn't see an answer, has >it been resolved? I am trying to create a singleton class heirarchy without >having to override getInstance.... > > class Test { > public static function getInstance() { > return new self(); > } > } > > class Foo extends Test { > } > > var_dump(Foo::getInstance()); >?> >thekid@friebes:~/devel/php/tests > php5 self.php >object(test)#1 (0) { >} > >Expected output would be "object(foo)", so I guess either "self" should >not be evaluated at compile time or this should be disallowed. I'd >prefer the first:) > >http://www.zend.com/lists/engine2/200307/msg00033.html > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php