Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34039 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89885 invoked by uid 1010); 15 Dec 2007 00:07:53 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 89864 invoked from network); 15 Dec 2007 00:07:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Dec 2007 00:07:53 -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; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.162.229 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 64.233.162.229 nz-out-0506.google.com Received: from [64.233.162.229] ([64.233.162.229:1109] helo=nz-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 18/A4-58345-1DA13674 for ; Fri, 14 Dec 2007 19:07:49 -0500 Received: by nz-out-0506.google.com with SMTP id x7so718616nzc.38 for ; Fri, 14 Dec 2007 16:07:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; bh=LDPaEBlowWm0qX9K6j3cAfiYLJChOwTQq4pKOnVoUkg=; b=sWuy9AHpGFNPc8uZNo2POWilSfhMn4LfgqQLaxt+I45QZ79ngqKoOSdEa7B1HpuST6Jz0jHSRRtfdu9W5k9vczaR7X3j/GyHx5r6XoQnk0XeIRvRUO4OLD9VIMroNS9frI1ZXPdaT0d14PcB3nNv10umc1+6kNZOF5XZNcs5bgc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=VhwAW/Nds4JmMqjty29APSR5A/3nG1P8VDiVvR9QcZmEgM3JVbMAiLidZav6UfcStmRfsOyCse7S5z4J+/HFN5/xasVaf3yIF71vA3qg+TU1LhrnxK5/PaANK5aHWEET6oNBXnK/ICo4Sd2j0BW/x+/t8gjv7zvufnr/BYLECcU= Received: by 10.142.107.1 with SMTP id f1mr1990163wfc.77.1197677260567; Fri, 14 Dec 2007 16:07:40 -0800 (PST) Received: by 10.70.41.7 with HTTP; Fri, 14 Dec 2007 16:07:40 -0800 (PST) Message-ID: Date: Sat, 15 Dec 2007 01:07:40 +0100 Sender: ekneuss@gmail.com To: "Michael J. I. Jackson" Cc: internals@lists.php.net In-Reply-To: <9cd0f6980712141507y41ff348ay74caf5510856ec99@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_3279_3007514.1197677260522" References: <9cd0f6980712141507y41ff348ay74caf5510856ec99@mail.gmail.com> X-Google-Sender-Auth: 0f001fc3475eda36 Subject: Re: [PHP-DEV] New "static" keyword doesn't have private access? From: colder@php.net ("Etienne Kneuss") ------=_Part_3279_3007514.1197677260522 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hello, First, to be clear, you're mixing two kinds of static keywords: 1) a static method/property which represents a method/property that is bound to a class only 2) the "static" class reference Of course, private properties (static or not) are not accessible from any other scope than the one in which they are defined. In this context, static::$cls is translated to B::$cls, and will issue an error as B::$cls is not accessible from A's scope. Regards On Dec 15, 2007 12:07 AM, Michael J. I. Jackson wrote: > Hello all, > > I'm playing around with 5.3, and I noticed the following interesting > behavior: > > > class A > { > > private static $cls = __CLASS__; > > public static function who() > { > print static::$cls; > } > > } > > class B extends A > { > > private static $cls = __CLASS__; > > } > > B::who(); // Fatal error: Cannot access private property B::$cls > > I understand why this is happening, but IMO, this should not be > throwing an error. If "static" is supposed to be referencing the > "called class", we need a way to access ALL of the variables of that > class from its parent classes. Otherwise, there is no way to create > static class variables that won't be inherited in a hierarchy. If > there is, and I'm missing it, please forgive me and point it out. > > Regards, > > Michael > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- Etienne Kneuss http://www.colder.ch Men never do evil so completely and cheerfully as when they do it from a religious conviction. -- Pascal ------=_Part_3279_3007514.1197677260522--