php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47163 needs separate copy of member variable irrespictive access modifier changes.
Submitted: 2009-01-20 10:54 UTC Modified: 2009-01-20 12:31 UTC
From: vivekanandan8 at yahoo dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.2.6 OS: debian linux
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: vivekanandan8 at yahoo dot com
New email:
PHP Version: OS:

 

 [2009-01-20 10:54 UTC] vivekanandan8 at yahoo dot com
Description:
------------
i am using php 5.2.6 in debian linux platform.Having common  member variables names in classes used in inheritance still has problem.
when we declare as private for both member variable it works fine 
but when we declare parent member variable as public , it throws error

Expected result:
  needs seperate copy of the member variable as the same behaviour as both are private.
Actual Result:
 Access level to son::$mName must be public (as in class dad) i
 


vivek

Reproduce code:
---------------
<?
class dad { 
public $mName;     
function setDADName(){
	$this->mName='father'; 
}
}
    
class son extends dad {  
private $mName; 
function setSONName(){
	$this->mName='child'; 
}
}
  $oChildObj = new son;  
$oChildObj->setDADName(); 
$oChildObj->setSONName(); 
?>

Expected result:
----------------
both call to same member variable successfully assign  value to $mName same as when they are private in both clases(dad,son).

Actual result:
--------------
Access level to son::$mName must be public (as in class dad) 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-20 12:31 UTC] jani@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 19:01:30 2024 UTC