ID:          34445
 Updated by:  [EMAIL PROTECTED]
 Reported By: stochnagara at hotmail dot com
-Status:      Open
+Status:      Wont fix
 Bug Type:    Class/Object related
 PHP Version: 5CVS-2005-09-09 (snap)


Previous Comments:
------------------------------------------------------------------------

[2005-09-09 21:14:17] stochnagara at hotmail dot com

I do not agree with this explanation. I do not perform

foreach ($this as $k => $v) but foreach ($this['options'] as $k => $v)

Also i've tried with $this->params['options'] really set as an array
and it does not work too.

My current workaround is 

$opt = $this['options'];
foreach ($opt as $k => $v)

I still consider this is a bug and if there are any technical
difficulties for fixing it, I prefer to see bug status "Won't fix"
rather then "Bogus".

------------------------------------------------------------------------

[2005-09-09 20:34:31] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

ArrayAccess is no Iterator 

------------------------------------------------------------------------

[2005-09-09 20:30:22] stochnagara at hotmail dot com

Description:
------------
I made a class which implements ArrayAccess. Then I try to use foreach
on one of its array values and I get error "Objects used as arrays in
post/pre increment/decrement must return values by reference"

I've reduced the big code fragment to this small one:

Reproduce code:
---------------
<?
class foo implements ArrayAccess {
        protected $params;                      
        public function offsetGet ($field) { return $this->params[$field]; }
        public function offsetExists ($field) { return isset
($this->params[$field]); }      
        public function offsetUnset ($field) { unset ($this->params[$field]);
}
        public function offsetSet ($field, $value) { $this->params[$field] =
$value; }       
}

$foo = new foo;
foreach ($foo['options'] as $optionvalue => $optiontext) {}


Expected result:
----------------
no errors

Actual result:
--------------
Fatal error: Objects used as arrays in post/pre increment/decrement
must return values by reference in ... on line 161


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=34445&edit=1

Reply via email to