Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:55700 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 47853 invoked from network); 4 Oct 2011 21:36:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Oct 2011 21:36:26 -0000 Authentication-Results: pb1.pair.com header.from=chrisstocktonaz@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=chrisstocktonaz@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.42 as permitted sender) X-PHP-List-Original-Sender: chrisstocktonaz@gmail.com X-Host-Fingerprint: 209.85.213.42 mail-yw0-f42.google.com Received: from [209.85.213.42] ([209.85.213.42:49097] helo=mail-yw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 67/91-36224-95C7B8E4 for ; Tue, 04 Oct 2011 17:36:26 -0400 Received: by ywa8 with SMTP id 8so1034861ywa.29 for ; Tue, 04 Oct 2011 14:36:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=WK+ZM/18remIJe1L00ADnDUuGtxULAauye1f5cMM7HI=; b=leG0YE/BT6pSIhvUk6dq9+T89EgPqUEFWXTXxWPH8cy0ctSP+2BboMV+VjGo/LYhs/ S9PONeVi6JinmsEAyzJU6HDWJ9HB6fvECdv6Ht/dV+9bDxCmP6DK9GiflOkcjqP578+C 5p/4ptELQrwHcFPcxBz/LfiGBjNUkPKJVtBls= MIME-Version: 1.0 Received: by 10.42.247.195 with SMTP id md3mr2619650icb.122.1317764182456; Tue, 04 Oct 2011 14:36:22 -0700 (PDT) Received: by 10.42.170.132 with HTTP; Tue, 4 Oct 2011 14:36:22 -0700 (PDT) In-Reply-To: References: Date: Tue, 4 Oct 2011 14:36:22 -0700 Message-ID: To: "Matthew Weier O'Phinney" Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: Bug with static property access From: chrisstocktonaz@gmail.com (Chris Stockton) Hello, On Tue, Oct 4, 2011 at 11:33 AM, Matthew Weier O'Phinney wrote: > > That makes complete sense to me -- ClassA is referring to self, which > resolves to ClassA... which does not define a "VERSION" constant. Change > to this: > > =A0 =A0public $version =3D static::VERSION; > > and it should be fine. > Hi Matt, I knew what was wrong with the code as soon as I saw it :- ), the code itself was part of a much more complicated system and I was using it in a unexpected way. The reason it was difficult to troubleshoot is because the constant being whined about was not any (of the several) constants being evaluated at the line the error was for. I think the error should be thrown at compile time, not at runtime ONLY when a constant is being accessed. This could cause dangerous hard to catch errors that make it into production. In addition, as I understand and would like to make you aware that static is not allowed in compile time class constants. Which is slightly unusual and perhaps could be changed because it seems that there is already runtime resolving taking place here.