Edit report at http://bugs.php.net/bug.php?id=52968&edit=1
ID: 52968 User updated by: czambran at csrg dot inf dot utfsm dot cl Reported by: czambran at csrg dot inf dot utfsm dot cl Summary: Static private attributes visibility Status: Bogus Type: Bug Package: Class/Object related Operating System: Linux/Ubuntu Lucid Lynx PHP Version: Irrelevant Block user comment: N New Comment: [2010-10-02 06:16 UTC] ras...@php.net That's what private means. You are not allowed to access it from outside of the class. You can make a static accessor method in your Device class that returns it, if you like. ----- Because that, the problem is that php is allowing to access it from outside, without the using of the static accessor method :P. Greetings Previous Comments: ------------------------------------------------------------------------ [2010-10-02 10:48:16] cataphr...@php.net Automatic comment from SVN on behalf of cataphract Revision: http://svn.php.net/viewvc/?view=revision&revision=303931 Log: - Substantially improved the documentation of strtr(). Closes bug #52968. ------------------------------------------------------------------------ [2010-10-02 08:16:35] ras...@php.net That's what private means. You are not allowed to access it from outside of the class. You can make a static accessor method in your Device class that returns it, if you like. ------------------------------------------------------------------------ [2010-10-02 08:07:37] czambran at csrg dot inf dot utfsm dot cl Description: ------------ Static private attributes of a class can be directly by another non-friendly resource or file. Test script: --------------- If I define a class with static methods, as the following: class Device{ static private $id = 15; } For example, if the class Device is stored into device.class.php and I have another file called main.php and the implementation of main.php is the following: <?php include("device.class.php"); echo "The device's id is: ".Device::$id; ?> Expected result: ---------------- The device's id is 15. Actual result: -------------- Not relevant results yet. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=52968&edit=1