|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-10-27 13:19 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 08:00:02 2025 UTC |
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