Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56888 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3527 invoked from network); 12 Dec 2011 14:12:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Dec 2011 14:12:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:50481] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C7/B3-17834-BDB06EE4 for ; Mon, 12 Dec 2011 09:12:44 -0500 Received: by bkbzx1 with SMTP id zx1so2817635bkb.29 for ; Mon, 12 Dec 2011 06:12:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=b0D+8OfYOgh7eT1fvH7jf1nXLYZXU8RbQ4NmkWOGtKk=; b=jt+vy4O4yx2HeWa43tn+QlHM+rQqKnxVE+ChlNgN+dSekd7wUeLUYYslnvo+zCBm0A M+ctQMO7if+1TJU4d4ydtjVHiOai/hAJ1Z08Z/YpglAxkTPaS47dipUUldRqfnOqJ0kl Vtav6OUWpG0khDEjE9TunJLiv5X/GsgD9Y3qU= MIME-Version: 1.0 Received: by 10.205.122.76 with SMTP id gf12mr10183470bkc.21.1323699159674; Mon, 12 Dec 2011 06:12:39 -0800 (PST) Sender: ekneuss@gmail.com Received: by 10.204.192.72 with HTTP; Mon, 12 Dec 2011 06:12:39 -0800 (PST) In-Reply-To: <4EE60332.7000809@emag.ro> References: <4EE60332.7000809@emag.ro> Date: Mon, 12 Dec 2011 15:12:39 +0100 X-Google-Sender-Auth: rfWScrEdU1734e01mzuqoxismSk Message-ID: To: Bogdan Bezuz Cc: PHP Developers Mailing List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Unexpected behavior for :: From: colder@php.net (Etienne Kneuss) Hi, On Mon, Dec 12, 2011 at 14:35, Bogdan Bezuz wrote: > Hello, > I'm not sure if this is the desired behavior and i don't want to submit a > bogus bug report. > > class A > { > =C2=A0 =C2=A0public function f1() > =C2=A0 =C2=A0{ > =C2=A0 =C2=A0 =C2=A0 =C2=A0var_dump($this->_b); > =C2=A0 =C2=A0} > } > > class B > { > =C2=A0 =C2=A0public $_b =3D 'stuff'; > > =C2=A0 =C2=A0public function f2() > =C2=A0 =C2=A0{ > =C2=A0 =C2=A0 =C2=A0 =C2=A0A::f1(); > =C2=A0 =C2=A0} > } > > $b =3D new B(); > $b->f2(); > > At first i would expect an error since A was not instantiated, at most i > would expect to return NULL but not 'stuff'. > Is this a bug ? Not really, it's a BC compatibility that we had to drag since PHP4. If you enable E_STRICT, it should output a warning saying something like "importing $this from invalid context". It is/was scheduled for cleanup in the next major version. Best, > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > --=20 Etienne Kneuss http://www.colder.ch