From:             phpbugs at liwing dot de
Operating system: FreeBSD 5.0-CURRENT
PHP version:      4.3.1
PHP Bug Type:     Feature/Change Request
Bug description:  Overload hides properties in class methods, too

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!
-- 
Edit bug report at http://bugs.php.net/?id=22434&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22434&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22434&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22434&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22434&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22434&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22434&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22434&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22434&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22434&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22434&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22434&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22434&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22434&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22434&r=gnused

Reply via email to