#35460 [NEW]: infinite loop current()/next()

From: Date: Mon, 28 Nov 2005 22:39:52 +0000
Subject: #35460 [NEW]: infinite loop current()/next()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-89322@lists.php.net to get a copy of this message
From:             sitnikov at infonet dot ee
Operating system: Linux
PHP version:      4.4.1
PHP Bug Type:     *General Issues
Bug description:  infinite loop current()/next()

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);


-- 
Edit bug report at http://bugs.php.net/?id=35460&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=35460&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=35460&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=35460&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=35460&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=35460&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=35460&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=35460&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=35460&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=35460&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=35460&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=35460&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=35460&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=35460&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=35460&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=35460&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=35460&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=35460&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=35460&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=35460&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=35460&r=mysqlcfg


Thread (2 messages)

« previous php.bugs (#89322) next »