#23394 [Opn->Fbk]: wrong with reset()

From: Date: Tue, 29 Apr 2003 06:20:18 +0000
Subject: #23394 [Opn->Fbk]: wrong with reset()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-38684@lists.php.net to get a copy of this message
ID: 23394 Updated by: derick@php.net Reported By: tmgh at www dot deyang dot gov dot cn -Status: Open +Status: Feedback Bug Type: Output Control Operating System: win2000 server PHP Version: 4.3.2RC2 New Comment: Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2003-04-28 21:36:58] tmgh at www dot deyang dot gov dot cn 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. ------------------------------------------------------------------------ [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

« previous php.bugs (#38684) next »