#21888 [Com]: protected property and protected method of the same name
| From: | thekid at thekid dot de | Date: | Sat, 19 Apr 2003 15:52:41 +0000 |
| Subject: | #21888 [Com]: protected property and protected method of the same name | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-37901@lists.php.net to get a copy of this message | ||
ID: 21888
Comment by: thekid at thekid dot de
Reported By: ulf dot wendel at phpdoc dot de
Status: Open
Bug Type: Zend Engine 2 problem
Operating System: Win XP Prof
PHP Version: 5CVS-2003-01-26 (dev)
New Comment:
Cannot reproduce with latest CVS:
thekid@friebes:~/devel/php/tests > cat protected.php
<?php
class mom {
protected $prot = "protected property\n";
protected function prot() {
print "protected method\n";
}
}
class child extends mom {
public function callMom() {
$this->prot();
}
public function viewMom() {
print $this->prot;
}
}
$c = new child();
$c->callMom();
$c->viewMom();
?>
thekid@friebes:~/devel/php/tests > php5 protected.php
protected method
protected property
I guess this can be closed?
Previous Comments:
------------------------------------------------------------------------
[2003-01-26 14:55:55] georg@php.net
<ot>
welcome back (to the roots) Ulf !!
</ot>
------------------------------------------------------------------------
[2003-01-26 12:24:02] ulf dot wendel at phpdoc dot de
OO: in case I have a protected property and a protected method of the
same name, I'll get a fatal error messages saving:
Fatal error: Call to undefined function () in ...
PHP:
System Windows NT localhost 5.1 build 2600
Build Date Jan 23 2003 16:14:26
Server API CGI/FastCGI
Virtual Directory Support enabled
Configuration File (php.ini) Path E:\php\php.ini
PHP API 20020918
PHP Extension 20020429
Zend Extension 90021012
Debug Build no
Thread Safety enabled
Registered PHP Streams php, http, ftp, compress.zlib
Zend Engine v2.0.0-dev
Code:
class mom {
protected $prot = "protected property\n";
protected function prot() {
print "protected method\n";
}
}
class mom::child extends mom {
protected $prot;
public function callMom() {
$this->prot();
// $this->priv();
}
public function viewMom() {
print $this->prot;
// print $this->priv;
}
}
$c = new mom::child();
$c->callMom();
$c->viewMom();
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21888&edit=1