ID:               38716
 User updated by:  mmerlone at gmail dot com
 Reported By:      mmerlone at gmail dot com
-Status:           Bogus
+Status:           Open
-Bug Type:         Class/Object related
+Bug Type:         Documentation problem
 Operating System: Ubuntu linux 6.06 2.6.15-26-686
 PHP Version:      5.1.6
 New Comment:

So, if it works as expected, the documentation should be fixed, since
the example shows the __set changind a private variable.


Previous Comments:
------------------------------------------------------------------------

[2006-09-04 20:17:40] [EMAIL PROTECTED]

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



------------------------------------------------------------------------

[2006-09-04 20:08:51] mmerlone at gmail dot com

Description:
------------
Overloading method __set does not work for private variables as the
example "Example 19-20. overloading with __get, __set, __isset and
__unset example" from
http://us3.php.net/manual/en/language.oop5.overloading.php .
This is the same of bug #34893 (http://bugs.php.net/bug.php?id=34893)
which claims to be fixed, but is not.

Reproduce code:
---------------
<?
        class bla{
                private $variavel;
                function bla(){
                }
                function __set($vn, $vv){
                        $this->$vn = $vv;
                }
        }

        $bla = new bla();
        $bla->variavel = 1;
        echo "bla->variavel=".$bla->variavel."\n";
?>

Expected result:
----------------
bla->variavel=1

Actual result:
--------------
Fatal error: Cannot access private property bla::$variavel in
/devel/testes/private.php on line 14


------------------------------------------------------------------------


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

Reply via email to