From: tim at timcrider dot com
Operating system: Red Hat 9.0
PHP version: 5CVS-2003-10-10 (dev)
PHP Bug Type: Scripting Engine problem
Bug description: For loops against the alphabet don't function properly
Description:
------------
When trying to loop 'a' through 'z' using
for ($i = 'a'; $i < 'z'; $i++)
print $i;
it loops a-y as it should, but when you try
for ($i = 'a'; $i <= 'z'; $i++)
print $i;
instead of going a-z it goes a-yz doubling up the letters after a-z
a-z
aa-az
ba-bz
ca-cz
... etc
I know this breaks under php5, and under php4.
Reproduce code:
---------------
for ($i = 'a'; $i < 'z'; ++$i)
{
print "$i\n";
}
and
for ($i = 'a'; $i <= 'z'; ++$i)
{
print "$i\n";
}
Expected result:
----------------
abcdefghijklmnopqrstuvwxyz
(seperated by new lines)
Actual result:
--------------
abcdefghijklmnopqrstuvwxyzaaabacadaeaf....yxyyyz
--
Edit bug report at http://bugs.php.net/?id=25829&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25829&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25829&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=25829&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=25829&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=25829&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=25829&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=25829&r=support
Expected behavior: http://bugs.php.net/fix.php?id=25829&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=25829&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=25829&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=25829&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25829&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=25829&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=25829&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=25829&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=25829&r=float