|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-01-17 21:05 UTC] evert at rooftopsolutions dot nl
[2005-01-18 13:09 UTC] evert at rooftopsolutions dot nl
[2005-01-20 00:59 UTC] sniper@php.net
[2005-02-02 00:10 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 15:00:02 2025 UTC |
Description: ------------ When an array is directly accessed is accessed trough an overloaded class, it works just fine. When you access it trough foreach, it triggers an error. Reproduce code: --------------- <? class OlClass { var $data; function OlClass() { $this->data = new StdClass(); $this->data->arr = Array('a','b','c'); overload('OlClass'); } function __get($p,&$v) { $v = $this->data->$p; return true; } } $o = new OlClass; print_r($o->arr); foreach($o->arr as $value) echo($value); ?> Expected result: ---------------- Array ( [0] => a [1] => b [2] => c ) abc Actual result: -------------- Array ( [0] => a [1] => b [2] => c ) Warning: Invalid argument supplied for foreach() in /home/evert/public_html/dev/sabretooth/s41/test/test4.php on line 28