php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30428 __set()/__get property access
Submitted: 2004-10-14 05:52 UTC Modified: 2005-01-13 01:16 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: pavel at plpu dot permnet dot ru Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.0.1 OS: WinXP
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pavel at plpu dot permnet dot ru
New email:
PHP Version: OS:

 

 [2004-10-14 05:52 UTC] pavel at plpu dot permnet dot ru
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" !!!


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-13 01:16 UTC] tony2001@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

Duplicate of #28444.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 13:01:30 2024 UTC