#43115 [Opn->Bgs]: Resource ID Problem?
| From: | johannes@php.net | Date: | Sat, 27 Oct 2007 13:19:08 +0000 |
| Subject: | #43115 [Opn->Bgs]: Resource ID Problem? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-118998@lists.php.net to get a copy of this message | ||
ID: 43115
Updated by: johannes@php.net
Reported By: charpour at yahoo dot com
-Status: Open
+Status: Bogus
Bug Type: Streams related
Operating System: Linux (Slackware 10.1)
PHP Version: 5.2.4
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
New connection -> new Resource
Previous Comments:
------------------------------------------------------------------------
[2007-10-27 12:47:21] charpour at yahoo dot com
Description:
------------
When I'm opening several file descriptors (resource id's) with fopen or
any other resource type, the resource id keeps increasing even when I
close "previous" resource id's.
For example in a server/client example with stream sockets:
Client connects to the server...stream_socket_accept();
Client fd: Resource id #1
client quits.... fclose/socket_close
Client connects to the server...stream_socket_accept();
Client fd: Resource id #2
client quits.... fclose/socket_close
...
...
...
Client connects to the server...stream_socket_accept();
Client fd: Resource id #12456
Shouldn't the resource id reset to #1 when the second client
connected ?
Reproduce code:
---------------
<?php
set_time_limit(0);
ob_implicit_flush();
while (true) {
testit();
}
function testit() {
$fp = fopen('test','w');
print("Res: ".$fp."\n");
fclose($fp);
}
?>
Expected result:
----------------
Res: Resource id #1
Res: Resource id #1
Res: Resource id #1
....
....
Res: Resource id #1
Actual result:
--------------
Res: Resource id #1
Res: Resource id #2
Res: Resource id #3
....
....
Res: Resource id #20000
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43115&edit=1