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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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: Sat Dec 21 16:01:28 2024 UTC