php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21888 protected property and protected method of the same name
Submitted: 2003-01-26 12:24 UTC Modified: 2003-06-01 12:59 UTC
From: ulf dot wendel at phpdoc dot de Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2003-01-26 (dev) OS: Win XP Prof
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ulf dot wendel at phpdoc dot de
New email:
PHP Version: OS:

 

 [2003-01-26 12:24 UTC] 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();

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-26 14:55 UTC] georg@php.net
<ot>
welcome back (to the roots) Ulf !!
</ot>

 [2003-04-19 10:52 UTC] thekid at thekid dot de
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?
 [2003-06-01 12:59 UTC] helly@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Aug 17 15:00:03 2025 UTC