#21060 [NEW]: range() gives warning and returns false when low == high
| From: | cnb at freedomink dot org | Date: | Tue, 17 Dec 2002 07:13:37 +0000 |
| Subject: | #21060 [NEW]: range() gives warning and returns false when low == high | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-27918@lists.php.net to get a copy of this message | ||
From: cnb@freedomink.org
Operating system: Linux 2.4.18
PHP version: 4CVS-2002-12-16 (dev)
PHP Bug Type: Arrays related
Bug description: range() gives warning and returns false when low == high
<?php
range(2,2);
?>
Warning: range() [http://www.php.net/function.range]:
step exceeds the specified range in - on line 3
Numerous scripts expect range() to return the low
(or high) value (in this case 2 ) when low == high.
This is useful in cases where the low and high values
are dynamically generated.
But since the default step is 1, there is a warning
and a FALSE returned when low == high.
http://freedomink.org/code/php/patches/array.c.patch
The above patch makes range return low when
(low == high).
Please comment.
- Chandrashekhar
--
Edit bug report at http://bugs.php.net/?id=21060&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=21060&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=21060&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=21060&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=21060&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=21060&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=21060&r=support
Expected behavior: http://bugs.php.net/fix.php?id=21060&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=21060&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=21060&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=21060&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21060&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=21060&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=21060&r=isapi