Re: PHP 5.2-dev "Cannot use array returned from foo::__get('bar') in write context"

From: Date: Wed, 19 Jul 2006 13:32:42 +0000
Subject: Re: PHP 5.2-dev "Cannot use array returned from foo::__get('bar') in write context"
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-24676@lists.php.net to get a copy of this message
On 19.7.2006 15:24 Uhr, Richard Quadling wrote:
For PHP 5.2.0-dev (cli) (built: Jul 12 2006 12:20:25), I get ... Fatal error: Cannot use array returned from foo::__get('bar') in write context in C:\- on line 16 But only once, not 1 per line. $f = new foo(); $a = $f->bar; foreach($a as $key => $value) fixes the code.
I know (forgot to mention it), but still annoying as I have to fix a lot of lines to do that. If there are technical reasons for the fatal error, fine, I have to live with it then. But I still hope, it's just an overlook somewhere :) chregu
On 19/07/06, Christian Stocker <christian.stocker@bitflux.ch> wrote:
Just updated to the latest PHP 5.2-dev from CVS and now I get an Fatal error with the following code *** <?php class foo {
     public function __get($member) {
         return array("foo"=>"bar","bar"=>"foo");
     }
} $f = new foo(); //error foreach($f->bar as $key => $value) {
     print "$key => $value";
} ?> *** It throws a "Fatal error: Cannot use array returned from foo::__get('bar') in write context" on the foreach line. Quite annoying :) That worked fine with 5.1 and also with 5.2-dev from a few days/weeks ago (don't know, when I cvs-uped last time, but can't be that long) Is that expected/wished behaviour? chregu -- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 44 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | christian.stocker@bitflux.ch | GPG 0x5CE1DECB -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
-- christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich phone +41 44 240 56 70 | mobile +41 76 561 88 60 | fax +41 1 240 56 71 http://www.bitflux.ch | christian.stocker@bitflux.ch | GPG 0x5CE1DECB

« previous php.internals (#24676) next »