PHP OOP - private variable accessible from outside class with var_dump? -
i have class user variable: private $upass;
i noticed when creating instance of user , run var_dump on instance lists private variables? there way turn off?
class user { private $uid; private $uname; private $upass; private $upowers; $teammembers[$count] = new user(); foreach ($teammembers $teammember) { var_dump($teammember); }
and output shows everything, including passwords ... ofcourse they're encrypted, still don't want them accessible this!?
what's correct way solve this?
it's doing says does:
all public, private , protected properties of objects returned in output unless object implements __debuginfo() method (implemented in php 5.6.0).
so can implement custom __debuginfo
method, or alternatively, stop worrying it. security risk if has access source code, or serialized copy of object, both of signs of wider security issue.
Comments
Post a Comment