Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:43319 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84781 invoked from network); 11 Mar 2009 22:14:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Mar 2009 22:14:21 -0000 Authentication-Results: pb1.pair.com header.from=quickshiftin@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=quickshiftin@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.44.28 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: quickshiftin@gmail.com X-Host-Fingerprint: 74.125.44.28 yx-out-2324.google.com Received: from [74.125.44.28] ([74.125.44.28:56664] helo=yx-out-2324.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6E/AF-09289-08738B94 for ; Wed, 11 Mar 2009 17:14:10 -0500 Received: by yx-out-2324.google.com with SMTP id 8so155734yxb.83 for ; Wed, 11 Mar 2009 15:12:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type; bh=LYKKDiE+J2l5wM52tBjtHmeBYkgG/4soF7n2neLbLU4=; b=bvJjwJVZkehuSeO4Sl/KCcCLRxYprskcxd/85Ed3x3FOL2rs1V3gEAq1abYAvMRbUM 0p+N2Ir4rncX/gzK3HrnodiDNhdUfYhsdMf4VoGo5i+gNc8EDj/6dLY+nJo+6JaeTiCa Imn0tS3dUaQ/tq3sj0d9DLQgEkITsNmMd/3JE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=tzKA8hnc9JjPd3EgS7BLEqnrVD7dKdu1YMT4K7cTHzwiuYpyXZShAxha26iH/GcuEj 3fn68Cdn0Cd+jdy85ZxLPsOV/7ELLu42oQg0kvqyh/AmRpVkAC/ju1r3YDuRboAXVf1F 9bPAbTALmwZ/C9mzHnRqF3sL+0Ra9N4+a7P0U= MIME-Version: 1.0 Received: by 10.231.20.5 with SMTP id d5mr2107593ibb.54.1236809552442; Wed, 11 Mar 2009 15:12:32 -0700 (PDT) In-Reply-To: References: Date: Wed, 11 Mar 2009 16:12:32 -0600 Message-ID: <7dd2dc0b0903111512g798af3fco66141a925508b4fd@mail.gmail.com> To: olivier@ajeux.com Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=000325575a3607365f0464df2af1 Subject: Re: [PHP-DEV] non static function called as static one From: quickshiftin@gmail.com (Nathan Nobbe) --000325575a3607365f0464df2af1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On Wed, Mar 11, 2009 at 3:16 PM, Olivier Doucet wrote: > Hello, > > I posted the same topic on the general mailing list, but it appears this > can > be posted here, as it is open to feedbacks and is about PHP implementation > of static functions. > > I'm wondering if the following behaviour is a bug or a feature. The case is > quite complex, so let me explain my point of view. > here is the source : > > > class MyTest { > public function myfunc() { > echo get_class($this); > } > } > class MySecondTest { > public function test() { > MyTest::myfunc(); > } > } > > $test = new MySecondTest(); > $test->test(); //output: "MySecondTest" > > ?> not sure if this was mentioned on the general list but, i believe what youre describing is documented in the manual under php5 classes/objects -> "the basics": http://www.php.net/manual/en/language.oop5.basic.php $this is a reference to the calling object (usually the object to which the method belongs, but can be another object, if the method is called statically from the context of a secondary object). -nathan --000325575a3607365f0464df2af1--