php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33719 foreach clash
Submitted: 2005-07-16 05:11 UTC Modified: 2005-07-16 10:47 UTC
Votes:1
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: s dot masugata at digicom dot dnp dot co dot jp Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.4.0 OS: Solaris8
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: s dot masugata at digicom dot dnp dot co dot jp
New email:
PHP Version: OS:

 

 [2005-07-16 05:11 UTC] s dot masugata at digicom dot dnp dot co dot jp
Description:
------------
KEY and VALUE of foreach are made the duplicate variable, strange operation is 
done. 


Reproduce code:
---------------
<?php
$arr = array("1","123","12345");

foreach ( $arr as $val => $val ) {
//  echo "debug {$val}\n";
// this comment is removed, stranger operation is done. 

}

print_r( $arr );
?>

Expected result:
----------------
Array
(
    [0] => 1
    [1] => 123
    [2] => 12345
)

Actual result:
--------------
Array
(
    [0] => 1
    [1] => 2
    [2] =>
)
/usr/local/src/php-4.4.0/Zend/zend_execute.c(2436) :  Freeing 0x0838B164 (12 bytes), script=f.php

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-16 10:22 UTC] pajoye@php.net
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

Use 2 different variables.
 [2005-07-16 10:47 UTC] s dot masugata at digicom dot dnp dot co dot jp
It is understood that the description is wrong. 
PHP is a lazy language.
if will not to do fix, please manual add disclaimer.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC