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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 11:01:34 2025 UTC