Given this example:
class Database
{
private $host,
$database,
$username,
$password,
$type;
public $active_connection;
//Some methods
}
class Page
{
private $db;
public function __construct($id)
{
// Some code
$this->db = new Database($id);
}
//Some Methods
}
$page = new Page(0);
var_dump($page);
This will output the private variables of Database Object, even though they are marked as private (and so, as I understand it, unusable by the outside world).
My questions are:
- Is this a security risk?
- Is there a way to effectively hide those variables marked as private?
thanks in advance
EDIT: In this project, the admin section will provide the ability to create custom PHP scripts to incorporate in the site, as sections. Since this is being developed to a third party entity, my concern is that, for some reason, the costumer inadvertently dumps the $page object (which is, in our code, the main modifiable object) in order to "explore" it.