Bug #69391 [Opn->Nab]: Bug
| From: | aharvey@php.net | Date: | Tue, 07 Apr 2015 07:04:22 +0000 |
| Subject: | Bug #69391 [Opn->Nab]: Bug | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-191866@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69391&edit=1
ID: 69391
Updated by: aharvey@php.net
Reported by: farhan dot shahid001 at gmail dot com
Summary: Bug
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
PHP Version: 5.6.7
Block user comment: N
Private report: N
New Comment:
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
funcA() is still a method defined on A, so any private properties within A (such as $tempVar) are
accessible to it. This is by design.
Previous Comments:
------------------------------------------------------------------------
[2015-04-07 06:59:52] farhan dot shahid001 at gmail dot com
Description:
------------
The private members are accessible within the Derived Classes.
Test script:
---------------
class A
{
private $tempVar=10;
function funcA()
{
$this->tempVar=20;
echo $this->tempVar;
}
}
class B extends A
{
}
$obj=new B;
$obj->funcA();
Expected result:
----------------
It should give an error because the property $tempVar is private and should not be available to
derived classes.
Actual result:
--------------
It is printing the value of $tempVar.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69391&edit=1