Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:33543 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 55829 invoked by uid 1010); 30 Nov 2007 11:47:55 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 55814 invoked from network); 30 Nov 2007 11:47:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Nov 2007 11:47:54 -0000 Authentication-Results: pb1.pair.com header.from=marco.kaiser@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=marco.kaiser@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.182.186 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: marco.kaiser@gmail.com X-Host-Fingerprint: 64.233.182.186 nf-out-0910.google.com Received: from [64.233.182.186] ([64.233.182.186:62500] helo=nf-out-0910.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2C/D4-16948-968FF474 for ; Fri, 30 Nov 2007 06:47:54 -0500 Received: by nf-out-0910.google.com with SMTP id e27so1921683nfd for ; Fri, 30 Nov 2007 03:47:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:content-language:x-cr-hashedpuzzle:x-cr-puzzleid:message-id; bh=siWyxMJNkGmrpzk2RtWaCmxP27CEeNuzi4z8Q3/o6/Y=; b=c3y0osXZ9ycNH0ULVS1q52G6K/pPyjeP+pzikttt/gcDppeiyXN+dqqoxkFU0913qqJpwjgOJr9tUnTiVnQRC2BNKZPz8CF7TSr8DiGTzBYbz3n7dVXFIw2p+LkHIVafd9I7N+83KB6uoBnI9vCydcvWVJ2d6nUik01PdHTmVa8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=received:from:to:subject:date:mime-version:content-type:content-transfer-encoding:x-mailer:thread-index:content-language:x-cr-hashedpuzzle:x-cr-puzzleid:message-id; b=cVhgB2TIEyc1t2mcFP4DNBQuPGPIue1P1O/e1e80UTUpT9eh6ddjBJAnFC2Nvpf0WBZJzXpq27UrPwfAgoTIvWeJDFy435iRPTzEb1LFCpRb86RoTDkS/S25atnqKyKHQxb2Wwntw/jti1JmeyZTIyPS0oyl6n8yKgvr2+NkP+4= Received: by 10.86.91.12 with SMTP id o12mr7155481fgb.1196423270753; Fri, 30 Nov 2007 03:47:50 -0800 (PST) Received: from think ( [217.7.237.75]) by mx.google.com with ESMTPS id 13sm1151919fks.2007.11.30.03.47.49 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 30 Nov 2007 03:47:49 -0800 (PST) To: Date: Fri, 30 Nov 2007 12:43:32 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: AcgzRjmDhhXd+ek4RgKWrbcVbYbBbw== Content-Language: de x-cr-hashedpuzzle: AHhi ArcG BNPd BvMw DDnw DlG5 E+5m F3O4 F5xd GBfL G/aC Hv3t IJq1 JLVR JYac KxwD;1;aQBuAHQAZQByAG4AYQBsAHMAQABsAGkAcwB0AHMALgBwAGgAcAAuAG4AZQB0AA==;Sosha1_v1;7;{3BF3CF33-9F8C-4CC4-B965-8984132B38EC};bQBhAHIAYwBvAC4AawBhAGkAcwBlAHIAQABnAG0AYQBpAGwALgBjAG8AbQA=;Fri, 30 Nov 2007 11:43:28 GMT;cAByAGkAdgBhAHQAZQAgAHAAcgBvAHAAZQByAHQAaQBlAHMAIAAuAC4ALgAuAA== x-cr-puzzleid: {3BF3CF33-9F8C-4CC4-B965-8984132B38EC} Message-ID: <474ff865.0d135e0a.4536.ffffa229@mx.google.com> Subject: private properties .... From: marco.kaiser@gmail.com ("Marco Kaiser") Hi List, _value = $value; } public function getValue) { return $this->_value; } public function setParent( $oParent ) { $this->_parent = $oParent; } public function showParentValue() { return $this->_parent->_value; } } $aa = new aaa(); $aa->setValue(500); $bb = new aaa(); $bb->setParent($aa); echo $bb->showParentValue() . PHP_EOL; ?> The code above shows me a feature thats bypass my class design. :) With this code it is possible to access the private class property _value from $aa. Output: 500 If i us a other class like : class cc { private $_value = 'foo'; } $aa = new cc(); $bb = new aaa(); $bb->setParent($aa); echo $bb->showParentValue() . PHP_EOL; i get an error that tells me cc:$_value is private and could not be accessed. Thats ok. But with this change i cant overload or change my property in any way. class cc extends aaa { private $_value = 'foo'; } $aa = new cc(); $bb = new aaa(); $bb->setParent($aa); echo $bb->showParentValue() . PHP_EOL; echo $aa->getValue() . PHP_EOL; the output is: 0 0 Thats a bit strange to me because i expected a different behavior. Conclusion: 1. Why i can access a private property from a different class instance (name) but same type ? $aa and $bb are instances of aaa but not the same. 2. This doesnt works if cc is a own class with same property name (ie. interface or something like this) 3. Is it a bug that i can't use same property name in my child class? (normaly the parent property isnt visible to the child) cc extends aaa. Thats just some questions :) -- Marco