Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10468 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1194 invoked by uid 1010); 15 Jun 2004 13:58:39 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 1169 invoked from network); 15 Jun 2004 13:58:38 -0000 Received: from unknown (HELO is.magroup.ru) (213.33.179.242) by pb1.pair.com with SMTP; 15 Jun 2004 13:58:38 -0000 Received: from localhost.localdomain ([192.168.3.226]) by is.magroup.ru with Microsoft SMTPSVC(5.0.2195.6713); Tue, 15 Jun 2004 17:59:19 +0400 Date: Tue, 15 Jun 2004 17:59:18 +0400 To: internals@lists.php.net Message-ID: <20040615175918.57e77cbb.tony2001@phpclub.net> X-Mailer: Sylpheed version 0.9.11 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 15 Jun 2004 13:59:19.0147 (UTC) FILETIME=[F3E883B0:01C452E0] Subject: Weird behaviour of private attribute + overloaded method From: tony2001@phpclub.net (Antony Dovgal) Hi all! What do you expect from this code? id; } public function setId ($id) { return $this->id = $id; } } class Bar extends Foo { public function setId ($id) { return $this->id = $id; } } $b = new Bar; $b->setId(123); var_dump($b->getId()); ?> It outputs 'bool(false)', while I expect it to print 'int(123)'. Changing private $id to public or protected solves the problem. Adding getId() method to the Bar solves it too, but this is obviously rather silly solution. Am I missing something and this is really expected behaviour ? --- WBR, Antony Dovgal aka tony2001 tony2001@phpclub.net || antony@dovgal.com