php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35460 infinite loop current()/next()
Submitted: 2005-11-28 23:39 UTC Modified: 2005-11-28 23:42 UTC
From: sitnikov at infonet dot ee Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.4.1 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: sitnikov at infonet dot ee
New email:
PHP Version: OS:

 

 [2005-11-28 23:39 UTC] sitnikov at infonet dot ee
Description:
------------
subj

Reproduce code:
---------------
<?php

$arr = array (1,2,3,4,5);

function foo($data){
  $total_row = count($data);
  @reset($data);

  $row = 1;

  while ($tmp = current($data))
  {
    if ($row>$total_row){
    	die("To many iteration");
    }

    print_r($tmp);
    
    $row++;
    next($data);
  }
}

foo($arr);


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-28 23:42 UTC] tony2001@php.net
Fixed in CVS about a month ago.
You could just ask me, eh?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 19:01:30 2024 UTC