ID:               37964
 Updated by:       [EMAIL PROTECTED]
 Reported By:      lavin dot peter at gmail dot com
 Status:           Assigned
 Bug Type:         Scripting Engine problem
 Operating System: Windows XP
 PHP Version:      5.1.4
 Assigned To:      tony2001
 New Comment:

That is why we have a new serializing interface which allows you to
call a serializing function in the base class which then can deal with
the private properties in that base class.


Previous Comments:
------------------------------------------------------------------------

[2006-08-20 09:31:05] ruslan dot kyrychuk at gmail dot com

I'd say it is not correct. Properties and methods defined as private
are inherited but you have no access to this properties in child
class.
If for example during serializing if you ommit private properties of
base class - you'll get wrong object.

class Base{
  private $basevar;
  public function baseFunction(){return $this->basevar;}
}
class Derived extends Base{}

if private properties are not inherited - than calling baseFunction
will cause null result and this is not correct in class inheritance.

------------------------------------------------------------------------

[2006-07-04 14:13:08] lavin dot peter at gmail dot com

The "getMethods" method of ReflectionClass also returns the private
methods of the parent class.

------------------------------------------------------------------------

[2006-06-29 20:06:15] lavin dot peter at gmail dot com

Description:
------------
When using the export method of ReflectionClass the private methods of
of a parent class are displayed.

Reproduce code:
---------------
class Base{
  private $basevar;
  private function baseFunction(){}
}
class Derived extends Base{}
$d = new Derived;
Reflection::export(new ReflectionClass($d));



Expected result:
----------------
Since properties and methods defined as private are not inherited, the
exported Base class should have no properties or methods but in fact
the private method of the Parent class shows up.

Actual result:
--------------
Class [ class Derived extends Base ] { @@ C:\Program Files\Apache
Group\Apache2\htdocs\newstuff\captcha\refbug.php 6-6 - Constants [0] {
} - Static properties [0] { } - Static methods [0] { } - Properties [0]
{ } - Methods [1] { Method [ private method baseFunction ] { @@
C:\Program Files\Apache
Group\Apache2\htdocs\newstuff\captcha\refbug.php 4 - 4 } } } 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=37964&edit=1

Reply via email to