#34752 [NEW]: foreach seam to overwrite values
| From: | trash at jennyfm dot net | Date: | Thu, 06 Oct 2005 08:58:11 +0000 |
| Subject: | #34752 [NEW]: foreach seam to overwrite values | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-86081@lists.php.net to get a copy of this message | ||
From: trash at jennyfm dot net
Operating system: linux 2.6.13
PHP version: 5.0.5
PHP Bug Type: Scripting Engine problem
Bug description: foreach seam to overwrite values
Description:
------------
foreach seam to overwrite values in array .....
it works fine in 5.0.4 but in 5.0.5 not.
don't know why...
Reproduce code:
---------------
full class source here: http://kuerbis.org/template/show_source.php
class Template extends KTemplate {
...........
protected function _initTemplate()
{
parent::_initTemplate();
if (isset($this->bl) && is_array($this->bl))
{
print_r($this->bl);
//before foreach bl is ok in 5.0.4 and 5.0.5
foreach ($this->bl as $key => $value)
{
$this->blc[$key] = true;
}
//after foreach bl is overwritten in 5.0.5, in 5.0.4 it works
print_r($this->bl);
}
}
......
}
Expected result:
----------------
in php 5.0.4 i get (after the foreach)
.......
Array
(
[mainmenu] => KTemplateExt Object
(
[removeEmptyBlocks] => 1
[delimiterStart:protected] => {
[delimiterEnd:protected] => }
[t:protected] =>
{menu_title}
[pl:protected] =>
[bl:protected] =>
[templatefile:protected] =>
[className:protected] => KTemplateExt
[params] =>
)
)
.... and so on
Actual result:
--------------
in php 5.0.5 i get (after the foreach)
(
[menublock] => Array
(
[menublock] => 1
[not_logged_in] => 1
[logged_in] => 1
)
[not_logged_in] => 1
[logged_in] => 1
)
.... and so on
--
Edit bug report at http://bugs.php.net/?id=34752&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=34752&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=34752&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=34752&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=34752&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=34752&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=34752&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=34752&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=34752&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=34752&r=support
Expected behavior: http://bugs.php.net/fix.php?id=34752&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=34752&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=34752&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=34752&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=34752&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=34752&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=34752&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=34752&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=34752&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=34752&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=34752&r=mysqlcfg