php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30135 private/protected variables are not protected
Submitted: 2004-09-17 19:44 UTC Modified: 2004-09-18 07:12 UTC
From: sh4dow at php dot pl Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.0.1 OS: Win2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: sh4dow at php dot pl
New email:
PHP Version: OS:

 

 [2004-09-17 19:44 UTC] sh4dow at php dot pl
Description:
------------
The private and protected variables ar not protected. print_f or var_dump display them without any errors.
Var_dump and print_f should have access from inside, but no outside.  

Reproduce code:
---------------
<?php

class Foo {
  private $password='pass1';
}

$foo = new Foo();

print_r($foo);

?>

Expected result:
----------------
null

Actual result:
--------------
Foo Object ( [password:private] => pass1 )

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-18 07:13 UTC] tony2001@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

This was done intentionally to reduce time for debugging. 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 07:01:33 2025 UTC