Edit report at http://bugs.php.net/bug.php?id=52968&edit=1

 ID:                 52968
 Updated by:         ras...@php.net
 Reported by:        czambran at csrg dot inf dot utfsm dot cl
 Summary:            Static private attributes visibility
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Class/Object related
 Operating System:   Linux/Ubuntu Lucid Lynx
 PHP Version:        Irrelevant
 Block user comment: N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[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

Reply via email to