php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30325 Error on the "while()"
Submitted: 2004-10-04 19:24 UTC Modified: 2004-10-04 22:30 UTC
From: miguelfd at sigmanet dot com dot br Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.8 OS: Window 2k
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: miguelfd at sigmanet dot com dot br
New email:
PHP Version: OS:

 

 [2004-10-04 19:24 UTC] miguelfd at sigmanet dot com dot br
Description:
------------
The while() statement accept the foollowing comand, that is an unending while() loop.

Reproduce code:
---------------
$i = 0;
while ($i == $i) {
  echo "$i<br>\n";
  flush();
  $i++;
}

Expected result:
----------------
The PHP detects that it will be an unending loop and warn. Or maybe some directive in the php.ini file that allows or deny this and, if this is set to false, warns when some loop of this kind happens.

Actual result:
--------------
It is an eternal looping... That will ever show unending result and makes the server low...

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-04 22:30 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

PHP does not check code for unterminated loops, which in many situations are perfectly valid constructs. It does however has an execution time limit to prevent a loop from forever trashing your CPU.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Feb 07 07:00:01 2026 UTC