#119 Foreach php4.3 - mmcache 2.4.6

open
nobody
None
5
2005-03-16
2005-03-16
Anonymous
No

marceloehernandez@hotmail.com

$sArr[0]="Aqui";
$sArr[1]="donde";
foreach ($sArr as $idar => $element) {
echo "<br>element $element";
}

not work correct.

On version php4.3.8-2.1 and mmcache 2.4.6 it's correct.

Please help!

Discussion

  • Nobody/Anonymous

    Logged In: NO

    I have also noticed this in php 4.3.10

     
  • Bart Vanbrabant

    Bart Vanbrabant - 2005-05-06

    Logged In: YES
    user_id=1079679

    This workes fine in eAccelerator, a fork of mmcache.

     
  • Kevin Traas

    Kevin Traas - 2005-05-27

    Logged In: YES
    user_id=342496

    I just finished emailing the following to
    mmcache@turckware.ru, but the msg bounced.

    Note that I've discovered the same bug, but... I also have a
    work-around (Example #3 below).

    -------------
    The following code snippet works perfectly before compile.
    After compile, Example #1 ceases to work.

    <?php

    $a = array( 5 => "Five", 10 => "Ten", 15 => "Fifteen" );

    echo "Example 1:<BR>\n";
    foreach( $a AS $key => $value ) echo "$key --> $value<BR>\n";

    echo "<BR>Example 2:<BR>\n";
    foreach( $a AS $value ) echo "$value<BR>\n";

    echo "<BR>Example 3:<BR>\n";
    reset( $a );
    while( list( $key, $value ) = each( $a ) ) echo "$key -->
    $value<BR>\n";

    ?>

    I am using Debian Sarge with:

    # php4 -v
    PHP 4.3.10-15 (cli) (built: May 9 2005 08:54:56)
    Copyright (c) 1997-2004 The PHP Group
    Zend Engine v1.3.0, Copyright (c) 1998-2004 Zend Technologies
    with Turck MMCache v2.4.6, Copyright (c) 2002-2003
    TurckSoft, St. Petersburg, by Dmitry Stogov

    This problem appears to be related to the "$key => $value"
    syntax of the foreach() function.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks