php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9971 Crash
Submitted: 2001-03-24 11:26 UTC Modified: 2001-03-26 16:41 UTC
From: ufuk dot kocolu at isletmekulubu dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.0.4pl1 OS: nt40
Private report: No CVE-ID: None
 [2001-03-24 11:26 UTC] ufuk dot kocolu at isletmekulubu dot com
When I tried to create a for loop like (for $i = 0; $i = 10; $i++) ... it crashes out. After I changed the code like 
for ($i = 0; $i < 10; $i++) it is ok. Sometimes I have problem with $i++ too in for loops so I change them to $i+=$x.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-24 11:31 UTC] derick@php.net
Do you get a crash or a parse error?
 [2001-03-24 11:57 UTC] ufuk dot kocolu at isletmekulubu dot com
I get a crash, my whole system stops and I have to restart usually.
 [2001-03-24 12:04 UTC] ufuk dot kocolu at isletmekulubu dot com
I get a crash, my whole system stops and I have to restart usually.
 [2001-03-24 12:07 UTC] derick@php.net
Can you post the whole source of a script that crashes on the web somewhere? (Or if it's small, put it into this bug report). Can you also tell which version of PHP4 you are using?
 [2001-03-24 12:39 UTC] ufuk dot kocolu at isletmekulubu dot com
I use PHP4.0.5dev on NT4.0
the code is simple 
<table border=0>
<?
for ($i = 0; $i = $newvalue; $i++)
 {
?>
<tr>
<td>
<? echo $i; ?>
</td>
</tr>
<?
}
?>
</table>
 [2001-03-26 16:38 UTC] lyric@php.net
Two things.

1) You should use "$i == 10" for a comparison. By using a single equals, you're assigning 10 to $i, which is always "true".

2) What do you expect it to do?  If you want to loop to iterate 10 times, you should use "$i<10" (the loop continues while the second term is TRUE)

 [2001-03-26 16:41 UTC] lyric@php.net
Closing
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 23:01:26 2024 UTC