php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22433 range returns nothing
Submitted: 2003-02-26 07:43 UTC Modified: 2003-05-02 05:05 UTC
From: sergey at sociology dot kharkov dot ua Assigned:
Status: Closed Package: Arrays related
PHP Version: 4.3.2-RC3-dev OS: all
Private report: No CVE-ID: None
 [2003-02-26 07:43 UTC] sergey at sociology dot kharkov dot ua
I have found a bug on page function.range.html
[chm date: 2002-12-27]...

Server hand-ups when I use russian letters:

foreach(range('?','?') as $letter) { 
   echo $letter; 
} 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-26 10:40 UTC] sniper@php.net
reclassified..

 [2003-03-02 04:19 UTC] victor@php.net
This particular example can not be found in function.range.html afaik.

I think it's a bug in PHP since it crashes. We _could_ mention this in the manual, but I think it's better to fix it (i.e. move it to 'Reproducible crash' or similar)

Connecting to my.private.site[192.168.0.1]:80... connected.
HTTP request sent, awaiting response...
10:16:18 ERROR -1: No data received.

 [2003-04-26 00:35 UTC] philip@php.net
So what's the problem here?  I do this:

error_reporting(E_ALL);
var_dump( range('?','?') );
print 'hi';

and get no output at all, no segfault either.  Doesn't sound like a documentation problem and if it is please say why and reclassify again...
 [2003-05-01 20:07 UTC] pollita@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

Perhaps it helps to note that: ord('?') == 255

What's happening is that the for loop which creates the range array is rolling over back to 0 on the last step, and since 0 is in fact less than 255, it keeps going...

and going...

and going...

Anyway, it should be fixed now, including the opposite version of this bug { range('a',chr(0)); }
 [2003-05-01 20:10 UTC] sniper@php.net
# php -r "var_dump( range('?','?') );"

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 35 bytes)


 [2003-05-02 05:05 UTC] sniper@php.net
It is fixed in CVS indeed.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 20:01:30 2024 UTC