From:             [EMAIL PROTECTED]
Operating system: Windows 2000
PHP version:      4.1.1
PHP Bug Type:     Arrays related
Bug description:  foreach doesnt reset object arrays

Using reset on an array of objects seems to alter the array counters of the
object's arrays, even though foreach is not dealing with that array. 
Then, as foreach is supposed to, it doesnt reset them.

Example:

class child{
  var $items = array("A1", "A2", "A3");
}
$arr=array(new child, new child, new child);
print "step1<br>";
print sizeof($arr)."<br>";
foreach($arr as $v)
  print $v->items[0]."<br>";  // Three A1 printed
print "<hr>step2<br>";
print sizeof($arr)."<br>";
foreach($arr as $v)
  print $v[1]."<br>";  // No A1 printed


-- 
Edit bug report at: http://bugs.php.net/?id=15340&edit=1
Fixed in CVS: http://bugs.php.net/fix.php?id=15340&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=15340&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=15340&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=15340&r=oldversion
Not for support: http://bugs.php.net/fix.php?id=15340&r=support
Not wrong behavior: http://bugs.php.net/fix.php?id=15340&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=15340&r=notenoughinfo


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to