#23394 [Opn]: wrong with reset()
| From: | tmgh at www dot deyang dot gov dot cn | Date: | Tue, 29 Apr 2003 02:36:58 +0000 |
| Subject: | #23394 [Opn]: wrong with reset() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-38669@lists.php.net to get a copy of this message | ||
ID: 23394
User updated by: tmgh at www dot deyang dot gov dot cn
Reported By: tmgh at www dot deyang dot gov dot cn
Status: Open
Bug Type: Output Control
Operating System: win2000 server
PHP Version: 4.3.2RC2
New Comment:
the code is here:
function get_poll_data($poll_id) {
$this->total_votes=0;
if (file_exists("$this->include_path/polldata/$poll_id")) {
$line = file("$this->include_path/polldata/$poll_id");
if
(ereg(".*\\|[0-9]+\\|[0-9]+\\|[0-9]{1}\\|[0-9]{1}\\|[0-9]{1}\\|[0-9]{1}",$line[0]))
{
list($question,$timestamp,$exp_time,$expire,$logging,$status,$comments)
= split("\\|",$line[0]);
$this->question = $question;
$this->comments = chop($comments);
$this->poll_array = '';
$this->color_array = '';
for ($i=1; $i<sizeof($line); $i++) {
list($name,$vote,$gif_color) =
split("\\|",$line[$i]);
$this->poll_array[$name] = $vote;
$this->color_array[$name] = chop($gif_color);
$this->total_votes += $vote;
}
for (reset($this->poll_array),$this->maxvote=0;
$key=key($this->poll_array); next($this->poll_array)) {
$this->maxvote =
($this->poll_array[$key]>$this->maxvote) ? $this->poll_array[$key] :
$this->maxvote;
}
return true;
}
} else {
return false;
}
}
apache2.0.45 report the error line:
for (reset($this->poll_array),$this->maxvote=0;
$key=key($this->poll_array); next($this->poll_array))
when i use php4.3.1,it's correct.can you tell me how to
do?ps,php4.3.2rc2 is faster than php4.3.1,good job.thanks.
Previous Comments:
------------------------------------------------------------------------
[2003-04-28 21:23:46] tmgh at www dot deyang dot gov dot cn
[client 10.76.1.61] PHP Warning: reset(): Passed variable is not an
array or object in f:\website\poll\include\class_poll.php on line 168,
referer: http://10.76.1.6/index3.htm
[client 10.76.1.61] PHP Warning: key(): Passed variable is not an
array or object in f:\website\poll\include\class_poll.php on line 168,
referer: http://10.76.1.6/index3.htm
what's the wrong?there must be have varies?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=23394&edit=1