php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29515 While cycle error
Submitted: 2004-08-04 02:12 UTC Modified: 2004-08-25 01:00 UTC
From: borivoje at gmail dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4.3.8 OS: Windows XP
Private report: No CVE-ID: None
 [2004-08-04 02:12 UTC] borivoje at gmail dot com
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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-08-04 07:56 UTC] derick@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.
 [2004-08-04 19:51 UTC] borivoje at gmail dot com
<?php
$string = "helo,here,is,an,example";
$paragraphs = explode(",", $string);
$position = 10;

while (list($index, $thing) = each($paragraphs)) {
  echo $position;
  // here anything...
}
?>
 [2004-08-04 22:22 UTC] borivoje at gmail dot com
I had no intention to confuse here, But...
I called this as a function from include file (these lines are in function). As a saparated example it works just fine. But when I call it from a function it displays error.
 [2004-08-17 17:25 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.


 [2004-08-25 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC