From: mahesh dot vemula at in dot ibm dot com
Operating system: RHEL 4
PHP version: 6CVS-2007-04-17 (snap)
PHP Bug Type: Feature/Change Request
Bug description: range() function behavior different on PHP6 and PHP5
Description:
------------
Output of PHP5 and PHP6 differ for range() function. The difference
appears when an empty string("") is given as low value and FLOAT as high
value. PHP5 gives the consistent output for an empty string and normal
string, which is an "array of float elements".
Whereas PHP6 treats empty and normal strings differently when high value
is a FLOAT. The output of range() with an empty string("") as low value is
"array of Integer elements" and with regular string as low value is "array
of float elements".
Environment:
Operating System: RHEL 4
Linux Kernel : Linux 2.6.9
PHP Version: PHP 5.2 (Built on Apr 17, 2007 from snaps.php.net)
PHP Configure Setup: ./configure
Reproduce code:
---------------
<?php
var_dump( range("", 2.2) );
var_dump( range("string", 2.2) );
?>
Expected result:
----------------
array(3) {
[0]=>
float(0)
[1]=>
float(1)
[2]=>
float(2)
}
array(3) {
[0]=>
float(0)
[1]=>
float(1)
[2]=>
float(2)
}
Actual result:
--------------
PHP5 gives the output as expected but PHP6 gives the following output:
array(3) {
[0]=>
int(0)
[1]=>
int(1)
[2]=>
int(2)
}
array(3) {
[0]=>
float(0)
[1]=>
float(1)
[2]=>
float(2)
}
--
Edit bug report at http://bugs.php.net/?id=41119&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=41119&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=41119&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=41119&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=41119&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=41119&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=41119&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=41119&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=41119&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=41119&r=support
Expected behavior: http://bugs.php.net/fix.php?id=41119&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=41119&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=41119&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=41119&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=41119&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=41119&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=41119&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=41119&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=41119&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=41119&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=41119&r=mysqlcfg