#40768 [NEW]: nested foreach break -- infinite loop - serious

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #40768 [NEW]: nested foreach break -- infinite loop - serious

    From: rave235 at gmail dot com
    Operating system: winxp
    PHP version: 5.2.1
    PHP Bug Type: Scripting Engine problem
    Bug description: nested foreach break -- infinite loop - serious

    Description:
    ------------
    i use just build i downloaded from site (5.2.1) no exts, no optimizers.
    it seem the $a,$b keep same internal pointer, this is quite serious error
    cos $b=$a should create separate array copy and it does but without the
    inner pointer.
    if you replace $b=$a with $b=array(1,2,3); it works as expected

    this was reported and ignored by someone on solaris before as well--
    #40608


    Reproduce code:
    ---------------
    $a=array(1,2,3);
    $b=$a;

    foreach($a as $A)
    {
    foreach($b as $B)
    {
    echo "$A,$B\n";
    break;
    }
    }

    Expected result:
    ----------------
    1,1
    2,1
    3,1

    Actual result:
    --------------
    1,1
    2,1
    3,1
    2,1
    3,1
    2,1
    3,1
    --infinite-

    --
    Edit bug report at [url]http://bugs.php.net/?id=40768&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=40768&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=40768&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=40768&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=40768&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=40768&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=40768&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=40768&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=40768&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=40768&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=40768&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=40768&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=40768&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=40768&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=40768&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=40768&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=40768&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=40768&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=40768&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=40768&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=40768&r=mysqlcfg[/url]
    rave235 at gmail dot com Guest

  2. Similar Questions and Discussions

    1. Mysql infinite loop?!
      this query doesnt work: SELECT d.cID,d.cLName,d.cFName , k.kid FROM cname d, cu_key e, rep_key f , `key` k WHERE (d.cLName LIKE '%') and (((e.cID...
    2. Weird Infinite loop
      Hello, I have this piece of code, and since i put it on a new webserver, it has caused an infinite loop. As you can see, n begins at 1, and B_x...
    3. #25037 [Opn->Asn]: SendText infinite loop
      ID: 25037 Updated by: iliaa@php.net Reported By: richard at bradders2000 dot co dot uk -Status: Open +Status: ...
    4. #25037 [Opn]: SendText infinite loop
      ID: 25037 User updated by: richard at bradders2000 dot co dot uk -Summary: SentText infinite loop Reported By: ...
    5. #25037 [NEW]: SentText infinite loop
      From: richard at bradders2000 dot co dot uk Operating system: Windows Server 2003 PHP version: 4.3.3RC3 PHP Bug Type: Mail...
  3. #2

    Default #40768 [Opn]: nested foreach break -- infinite loop - serious

    ID: 40768
    User updated by: abc at def dot ghi
    -Reported By: rave235 at gmail dot com
    +Reported By: abc at def dot ghi
    Status: Open
    Bug Type: Scripting Engine problem
    Operating System: winxp
    PHP Version: 5.2.1
    New Comment:

    wonder if someone can check this on linux build if its win issue.


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

    [2007-03-09 18:13:08] abc at def dot ghi

    Description:
    ------------
    i use just build i downloaded from site (5.2.1) no exts, no
    optimizers.
    it seem the $a,$b keep same internal pointer, this is quite serious
    error cos $b=$a should create separate array copy and it does but
    without the inner pointer.
    if you replace $b=$a with $b=array(1,2,3); it works as expected

    this was reported and ignored by someone on solaris before as well--
    #40608


    Reproduce code:
    ---------------
    $a=array(1,2,3);
    $b=$a;

    foreach($a as $A)
    {
    foreach($b as $B)
    {
    echo "$A,$B\n";
    break;
    }
    }

    Expected result:
    ----------------
    1,1
    2,1
    3,1

    Actual result:
    --------------
    1,1
    2,1
    3,1
    2,1
    3,1
    2,1
    3,1
    --infinite-


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40768&edit=1[/url]
    abc at def dot ghi Guest

  4. #3

    Default #40768 [Opn->Csd]: nested foreach break -- infinite loop - serious

    ID: 40768
    User updated by: abc at def dot ghi
    Reported By: abc at def dot ghi
    -Status: Open
    +Status: Closed
    Bug Type: Scripting Engine problem
    Operating System: winxp
    PHP Version: 5.2.1
    New Comment:

    me again,
    i just tried latest snapshot and it works fine there so i guess new
    snapshot should be released as i walked around some other strange
    things in that current 5.2.1.


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

    [2007-03-09 18:20:01] abc at def dot ghi

    wonder if someone can check this on linux build if its win issue.

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

    [2007-03-09 18:13:08] abc at def dot ghi

    Description:
    ------------
    i use just build i downloaded from site (5.2.1) no exts, no
    optimizers.
    it seem the $a,$b keep same internal pointer, this is quite serious
    error cos $b=$a should create separate array copy and it does but
    without the inner pointer.
    if you replace $b=$a with $b=array(1,2,3); it works as expected

    this was reported and ignored by someone on solaris before as well--
    #40608


    Reproduce code:
    ---------------
    $a=array(1,2,3);
    $b=$a;

    foreach($a as $A)
    {
    foreach($b as $B)
    {
    echo "$A,$B\n";
    break;
    }
    }

    Expected result:
    ----------------
    1,1
    2,1
    3,1

    Actual result:
    --------------
    1,1
    2,1
    3,1
    2,1
    3,1
    2,1
    3,1
    --infinite-


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40768&edit=1[/url]
    abc at def dot ghi Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139