#30428 [NEW]: __set()/__get property access
| From: | pavel at plpu dot permnet dot ru | Date: | Thu, 14 Oct 2004 03:52:45 +0000 |
| Subject: | #30428 [NEW]: __set()/__get property access | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-67563@lists.php.net to get a copy of this message | ||
From: pavel at plpu dot permnet dot ru
Operating system: WinXP
PHP version: 5.0.1
PHP Bug Type: Zend Engine 2 problem
Bug description: __set()/__get property access
Description:
------------
sorry for bad English.
I developing class library on PHP5.
All objects in library have property with set()/get()
access, and som property return objects.
But isnt work
ObjectA->propertyA->propertyB = "some value"
if propertyA return object instance.
simple example below
Reproduce code:
---------------
class A {
private $_caption = "test";
function __set($name,$value){
if($name == "caption") $this->_caption = $value;
}
}
class B {
private $_A;
function __construct(){
$this->_A = new A();
}
function __get($name){
if($name == "A") return $this->_A;
}
}
$B = new B();
//dont work!!!!!!
// Cannot access undefined property for object with overloaded property
access
$B->A->caption = "test";
// OK !!!!!
$T = $B->A;
$T->caption = "test";
Expected result:
----------------
i think
$Object->ObjectA->property = ""
must work !!!!! its bug !!!
this make __set()/__get() methods absolutely uneffective!!!
why i cant write for ex.
$Application->mainMenu->menuItem1->caption = "some" !!!
--
Edit bug report at http://bugs.php.net/?id=30428&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30428&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30428&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30428&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30428&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30428&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30428&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30428&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30428&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30428&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30428&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30428&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30428&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30428&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30428&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30428&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30428&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30428&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30428&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30428&r=mysqlcfg