From:             borivoje at gmail dot com
Operating system: Windows XP
PHP version:      4.3.8
PHP Bug Type:     Scripting Engine problem
Bug description:  While cycle error

Description:
------------
http://www.code-experts.com/listTopic.asp?tid=44

Reproduce code:
---------------
    echo $poss . ' -  positions<br/>';

    $paragraphs = explode("\n",$textToReplace);
        $ord = 0;
    
        while (list($breakIndex,$breakToReplace) = each($paragraphs)) {
          echo $poss . "<br/>"; // <------    here
          echo $breakIndex . "-" . $ord . "<br/>";
          if ($breakIndex % $poss = 0) {
                $ord = $ord + 1;
                if ($ord = 1) $paragraphs[$breakIndex] = "<p class='news_preview'>".
$breakToReplace . "<img class='news_pic_r'
src='$picDir/$article->picturePath1'/></p>";
                if ($ord = 2) $paragraphs[$breakIndex] = "<p class='news_preview'>".
$breakToReplace . "<img class='news_pic_l'
src='$picDir/$article->picturePath2'/></p>";
                if ($ord = 3) $paragraphs[$breakIndex] = "<p class='news_preview'>".
$breakToReplace . "<img class='news_pic_r'
src='$picDir/$article->picturePath3'/></p>";
          } else {
            $paragraphs[$breakIndex] = "<p class=\"news_preview\">".
$breakToReplace ."</p>";
          }     
        }


Expected result:
----------------
All ones (1 int)

Actual result:
--------------
First one then 0-oes

-- 
Edit bug report at http://bugs.php.net/?id=29515&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=29515&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=29515&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=29515&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=29515&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=29515&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=29515&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=29515&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=29515&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=29515&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=29515&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=29515&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=29515&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29515&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=29515&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=29515&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=29515&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29515&r=float

Reply via email to