From:
Operating system: Xp sp3
PHP version: 5.3.3
Package: Scripting Engine problem
Bug Type: Bug
Bug description:Different result when using a number than a variable.
Description:
------------
When i put a direct number or variable in a for block, it works fine, but
if i do an equation it fails. Even if it is very simple.
Test script:
---------------
<?php
error_reporting(0);
$index = "0";
$a = "0";
$b = "0";
//As you can see variable returns 1.
echo ">" . ($a==$b) . "<" . "<br>";
// So... this should go from 1 to 10.
// replace "($a==$b)" with 1 and everything works as it should.
for ($index=($a==$b); $index<=10; $index++)
{
// this always prints 1. An endless loop.
echo $index . "<br>";
}
?>
Expected result:
----------------
>1<
1
2
3
4
5
6
7
8
9
10
Actual result:
--------------
>1<
1
1
1
1
1
1
1
1
1
1
1
1
(infinite)
--
Edit bug report at http://bugs.php.net/bug.php?id=52650&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=52650&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=52650&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=52650&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=52650&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=52650&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=52650&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=52650&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=52650&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=52650&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=52650&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=52650&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=52650&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=52650&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=52650&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52650&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52650&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=52650&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=52650&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=52650&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=52650&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=52650&r=mysqlcfg