php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43115 Resource ID Problem?
Submitted: 2007-10-27 12:47 UTC Modified: 2007-10-27 13:19 UTC
From: charpour at yahoo dot com Assigned:
Status: Not a bug Package: Streams related
PHP Version: 5.2.4 OS: Linux (Slackware 10.1)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: charpour at yahoo dot com
New email:
PHP Version: OS:

 

 [2007-10-27 12:47 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-27 13:19 UTC] johannes@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 02:01:28 2024 UTC