Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:34961 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43706 invoked by uid 1010); 28 Jan 2008 13:20:59 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 43690 invoked from network); 28 Jan 2008 13:20:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jan 2008 13:20:59 -0000 Authentication-Results: pb1.pair.com header.from=rewbs.soal@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=rewbs.soal@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.166.182 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: rewbs.soal@gmail.com X-Host-Fingerprint: 64.233.166.182 py-out-1112.google.com Received: from [64.233.166.182] ([64.233.166.182:22678] helo=py-out-1112.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 61/B7-26775-AB6DD974 for ; Mon, 28 Jan 2008 08:20:59 -0500 Received: by py-out-1112.google.com with SMTP id u77so1863522pyb.16 for ; Mon, 28 Jan 2008 05:20:56 -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:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=jAADAX/Z+8VChONaqxPJw8CvRjP4BXnoodQIeTBh7KY=; b=O/uY+FPx1p1bLQXjMR7RjVVKfvP5ZMmbvS/Eo7QtHk6gbLqVaUcKqgYPaMrp6EmW3hbU8phVBX/xVh78HZApGJREeMuEG/tlBn6dpYDpnu4MiGtVZPAtDXKwGadG0jI/okzaeTbIOb7gPk0Ow9h6ZvvrTtV/lojgEcEq+9ofQ6g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=ctdSDuWpBkCfgzXoV8L9qdg6j3+NOdXJeKAUKqKaOIqzZWqP++LcpnDMSWUqUqYjTYtz55sf+5MAe8S79RcJdKlKPfFpSB+Az7rmHXcDJ6slQabtFWTUL13JxxFFycN4xRF7ZHFBPqGDRgOjt/4QvFb1K8EItTg/h2nXFifX+LM= Received: by 10.65.203.14 with SMTP id f14mr11399551qbq.12.1201526456326; Mon, 28 Jan 2008 05:20:56 -0800 (PST) Received: by 10.65.250.2 with HTTP; Mon, 28 Jan 2008 05:20:56 -0800 (PST) Message-ID: <5a8807d10801280520u7f8c7a9o8d2ab2efaa9c7644@mail.gmail.com> Date: Mon, 28 Jan 2008 13:20:56 +0000 Reply-To: robin@soal.org To: internals@lists.php.net MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Subject: [PHP-DEV] Protected static props redeclared as public share value across classes From: rewbs.soal@gmail.com ("Robin Fernandes") Hi all, If a protected static property is overridden by a public static property, both properties share the same value: This behaviour feels strange to me, because: 1. It only applies to that specific combination of visibility modifiers. If you change A::$a to public OR B::$a to protected, then A::$a and B::$a are treated as two separate entities. See pastebin.com/fca2cd5b and pastebin.com/f4f94b32d . 2. It is inconsistent with the behaviour of static methods. See: pastebin.com/f27f009c4 . 3. It differs from the behaviours of C#, Java and C++ (whereas, in most other respects, PHP and these languages share a lot of common ground regarding the concepts of visibility & static-ness). See: http://pastebin.ca/871576, http://pastebin.ca/871975 and http://pastebin.ca/871583. The code for this behaviour was added to zend_compile.c in rev 1.474 (back in sept 2003 :). If I change it to ensure that protected A::$a and public B::$a are treated as separate entities (quick patch against 5.2 snap here: pastebin.com/f7f175924 ), the only tests that fail are those specifically designed to check for this behaviour: Zend/tests/errmsg_024.phpt and ext/reflection/tests/static_properties_002.phpt. Is this a bug? If not, could you help me understand the decision to go with this inheritance rule? Many thanks! Robin