Here's that test. I don't have commit rights to that area of CVS so someone will need to do it for me.

John Mertic
jmer...@php.net

On 6/5/09 5:58 AM, Stan Vassilev wrote:
     3. When the caller tries to retrieve $object->foo, and foo is a 
private/protected member the caller has no access to, instead of an error, __get 
is called.

     I'm not very sure the current behavior on item 3 is the best one (maybe 
error should be thrown regardless?), but freezing on either would be better 
than leaving it undefined :)


   I always thought that this is the supposed behaviour. I believe I even 
relied on it in one of my projects


Hi,

If the community wants it like it is, then I'm just fine with that: as long as 
the test is committed, so that it doesn't change overnight. Any volunteers :)?

Regards,
Stan Vassilev
--TEST--
Test for __get() and __set() being able to access private/protected members
--FILE--
<?php
class Test {
    protected $x;
    private $y;
    
    function __get($name) {
        return $this->$name;
    }
        function __set($name, $val) {
            $this->$name = $val;
    }
}

$foo = new Test();
$foo->x = 'foo';
$foo->y = 'bar';
var_dump($foo->x);
var_dump($foo->y);
?>
===DONE===
--EXPECT--
string(3) "foo"
string(3) "bar"
===DONE===
--UEXPECT--
unicode(3) "foo"
unicode(3) "bar"
===DONE===
-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to