ID: 31581 Updated by: [EMAIL PROTECTED] Reported By: evert at rooftopsolutions dot nl -Status: Open +Status: Assigned Bug Type: Scripting Engine problem Operating System: Linux 2.4.26 PHP Version: 4CVS-2005-01-19 -Assigned To: +Assigned To: stas New Comment:
Yet another overload bug..Stas, can you look into this too? Previous Comments: ------------------------------------------------------------------------ [2005-01-18 13:09:06] evert at rooftopsolutions dot nl 28-Feb-2004 03:45 josh at uncommonprojects dot com One thing about __get is that if you return an array it doesn't work directly within a foreach... but we already figured that out :) ------------------------------------------------------------------------ [2005-01-17 21:05:35] evert at rooftopsolutions dot nl Did you mean I should test it on the snapshot, or is it solved on the latest snapshot? I noticed that a commenter on http://nl3.php.net/overload experienced the same problem. ------------------------------------------------------------------------ [2005-01-17 08:00:10] evert at rooftopsolutions dot nl 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31581&edit=1