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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 06:01:34 2025 UTC