#28444 [Com]: "Cannot access undefined property for object with overloaded property access"

From: Date: Sat, 21 Aug 2004 01:21:13 +0000
Subject: #28444 [Com]: "Cannot access undefined property for object with overloaded property access"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-65019@lists.php.net to get a copy of this message
ID: 28444 Comment by: matth at alsync dot com Reported By: dennis at inmarket dot lviv dot ua Status: Analyzed Bug Type: Class/Object related Operating System: WinXP PHP Version: 5.0.0RC2 New Comment: Another work around for this is: a->b->__set('c', 'value'); At least the underlying calsses do not need to be changed to make this work. Previous Comments: ------------------------------------------------------------------------ [2004-08-05 11:19:49] dennis at inmarket dot lviv dot ua To derick@php.net: Please don't feel hurt by this comment. I think you guys did a great job on making PHP5 what it is, but this bug is different. I think (but I mon sure, since I don't get anything in the PHP engine code) this should fix very well. ------------------------------------------------------------------------ [2004-08-05 11:04:45] derick@php.net There are plenty of other non fixed bugs. If we were to release when the bug count reaches zero we would never release. ------------------------------------------------------------------------ [2004-08-05 10:52:50] dennis at inmarket dot lviv dot ua In my opinion, such "workarounds" should be replaced by fixing the issue in PHP itself. Indeed, it is funny that this works for getting properties, and doesn't for setting. Onother question: how did PHP5 make for a release with this core level bug? ------------------------------------------------------------------------ [2004-08-05 07:20:16] alexei at net24 dot co dot nz another "workaround", it allows to use this feature now and to convert scripts later when this feature is available in php. class a { function __call ($property, $args){ return __get($property); } use it like this: $a->b->c=10; as $a->b()->c=10; echo $a->b->c; as echo $a->b()->c; ------------------------------------------------------------------------ [2004-08-05 06:48:18] alexei at net24 dot co dot nz it allows to read value referenced by $a->b->c but it does not allow to modify it, that's makes the whole thing inconsistent... workaround like below does the job, but it is ugly! $b=$a->b; $b->c=5; i think if ->-> is called it should call __get methods at all each stage and pass reference to the next -> operation ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/28444 -- Edit this bug report at http://bugs.php.net/?id=28444&edit=1

« previous php.bugs (#65019) next »