Edit report at http://bugs.php.net/bug.php?id=39118&edit=1
ID: 39118 Comment by: x at x dot com Reported by: steve at mountainmedia dot com Summary: Private members accessible to print_r Status: Bogus Type: Bug Package: Class/Object related Operating System: Fedora Core 4/Linux 2.6.14.3 PHP Version: 5.1.6 Block user comment: N Private report: N New Comment: Please, this is silly. Private and protected variables should be just that. Previous Comments: ------------------------------------------------------------------------ [2006-10-11 18:56:59] he...@php.net Why don't you simply disable these functions? ------------------------------------------------------------------------ [2006-10-10 18:19:03] steve at mountainmedia dot com "print_r(), var_dump() and var_export() will also show protected and private properties of objects with PHP 5." Can this behavior be disabled? A new feature perhaps? ------------------------------------------------------------------------ [2006-10-10 16:47:59] tony2...@php.net http://php.net/print_r ------------------------------------------------------------------------ [2006-10-10 16:40:16] steve at mountainmedia dot com "The visibility of a property or method can be defined by prefixing the declaration with the keywords: public, protected or private. Public declared items can be accessed everywhere. Protected limits access to inherited and parent classes (and to the class that defines the item). Private limits visibility only to the class that defines the item." How do you see this as not a bug considering that last statement in the documentation on Visibility in PHP 5 Classes (see http://us2.php.net/manual/en/language.oop5.visibility.php). This is either a bug or bad documentation. In all logic and understanding, the visibility of a private property should be hidden from any functions such as print_r, overriding the purpose of print_r. ------------------------------------------------------------------------ [2006-10-10 16:22:07] tony2...@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 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=39118 -- Edit this bug report at http://bugs.php.net/bug.php?id=39118&edit=1