#21060 [Opn->Bgs]: range() gives warning and returns false when low == high
| From: | iliaa@php.net | Date: | Fri, 20 Dec 2002 01:00:16 +0000 |
| Subject: | #21060 [Opn->Bgs]: range() gives warning and returns false when low == high | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-28052@lists.php.net to get a copy of this message | ||
ID: 21060
Updated by: iliaa@php.net
Reported By: cnb@freedomink.org
-Status: Open
+Status: Bogus
Bug Type: Arrays related
Operating System: Linux 2.4.18
PHP Version: 4CVS-2002-12-16 (dev)
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Nothing wrong with this behaviour, the low & high point are the same,
hence the false output indicating failure.
Previous Comments:
------------------------------------------------------------------------
[2002-12-17 01:13:37] cnb@freedomink.org
<?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 this bug report at http://bugs.php.net/?id=21060&edit=1