Test for edge cases with __get and property access flags

From: Date: Wed, 03 Jun 2009 20:48:53 +0000
Subject: Test for edge cases with __get and property access flags
Groups: php.internals 
Request: Send a blank email to internals+get-44136@lists.php.net to get a copy of this message
Hi, I created a test that covers the current behavior of __get and access flags in some edge cases: http://pastebin.com/d2ad892f5 Those are: 1. When a property is declared, but then unset via unset($this->foo), __get will be called. 2. When a property is declared private/protected, then unset and set again, it remains with the same access flags as originally declared (i.e. a private property remains private when set again). 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 :) My request is that the behaviors tested here are either improved for correctness, or freezed as is. And then this test, or modified version of it, is added to the PHP source code to faciliate that. Thanks. Regards, Stan Vassilev

« previous php.internals (#44136) next »