note 63231 added to language.oop5

From: Date: Thu, 16 Mar 2006 16:12:32 +0000
Subject: note 63231 added to language.oop5
Groups: php.notes 
Request: Send a blank email to php-notes+get-105933@lists.php.net to get a copy of this message
I just tried the following program : class Visitor{ public $name; private $passwd; public function __construct($name,$passwd){ $this->name = $name; $this->passwd=$passwd; } public function getPas(){ // only in order to control the modification return $this->passwd; } } $Visit=new Visitor("John","dshfkjqh"); $Visit->__construct("Bob","aaaa"); print($Visit->name."\n"); print($Visit->getPas()."\n"); The result is : Bob aaaa (!!!!!!!) So through an acces to the "public function" __construct, one can modify a private value ! I'm surprised ! and you ? ---- Server IP: 194.246.101.61 Probable Submitter: 139.124.5.46 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.php Edit -- http://master.php.net/note/edit/63231 Del: integrated -- http://master.php.net/note/delete/63231/integrated Del: useless -- http://master.php.net/note/delete/63231/useless Del: bad code -- http://master.php.net/note/delete/63231/bad+code Del: spam -- http://master.php.net/note/delete/63231/spam Del: non-english -- http://master.php.net/note/delete/63231/non-english Del: in docs -- http://master.php.net/note/delete/63231/in+docs Del: other reasons-- http://master.php.net/note/delete/63231 Reject -- http://master.php.net/note/reject/63231 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#105933) next »