php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #22434 Overload hides properties in class methods, too
Submitted: 2003-02-26 07:57 UTC Modified: 2012-02-26 08:00 UTC
From: phpbugs at liwing dot de Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 4.3.1 OS: FreeBSD 5.0-CURRENT
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: phpbugs at liwing dot de
New email:
PHP Version: OS:

 

 [2003-02-26 07:57 UTC] phpbugs at liwing dot de
More complex classes which's properties should become protected may need to modify / initializes some of their management properties in constructor or in an important member method.

Imagine a central factory manager using a list of meta objects . Or a public/private key manager class, which has to manager 3 lists, public keys, private keys and passphrases.

If the list aren't hard-coded in each class but list objects as members are used, a constructor like
class CertMgr
{
var $PublicKeys;
var $PrivateKeys;

function CertMgr()
{
  $this->PublicKeys = & new List();
  $this->PrivateKeys = & new List();
  $this->PublicKeys->SetValue( "mine", "abcdefg" );
  $this->PrivateKeys->SetValue( "mine", "secret-of-abcdefg" );
}

function __get( $pn, &$pv )
{
  if( $this->PublicKeys->KeyExists( $pn ) )
  {
    $pv = $this->PublicKeys->GetValue( $pn );
    return TRUE;
  }
  else
  {
    return FALSE;
  }
}

} // end of class CertMgr

overload( "CertMgr" );

$myCertMgr = new CertMgr(); // will fail!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-02-26 08:00 UTC] stas@php.net
We are sorry, but we can not support PHP 4 related problems anymore.
Momentum is gathering for PHP 6, and we think supporting PHP 4 will
lead to a waste of resources which we want to put into getting PHP 6
ready.


 [2012-02-26 08:00 UTC] stas@php.net
-Status: Open +Status: Wont fix -Package: Feature/Change Request +Package: *General Issues
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 18:01:30 2024 UTC