php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23394 wrong with reset()
Submitted: 2003-04-28 21:23 UTC Modified: 2003-05-09 07:42 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: tmgh at www dot deyang dot gov dot cn Assigned:
Status: No Feedback Package: Output Control
PHP Version: 4.3.2RC2 OS: win2000 server
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2003-04-28 21:23 UTC] 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?

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-28 21:36 UTC] 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-29 01:20 UTC] derick@php.net
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.

 [2003-05-09 07:42 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 14:01:29 2024 UTC