#32107 [Fbk->Opn]: fclose (STDIN|STDOUT|STDERR) not working
| From: | php at the-eend dot org | Date: | Fri, 25 Feb 2005 12:33:11 +0000 |
| Subject: | #32107 [Fbk->Opn]: fclose (STDIN|STDOUT|STDERR) not working | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-74558@lists.php.net to get a copy of this message | ||
ID: 32107
User updated by: php at the-eend dot org
Reported By: php at the-eend dot org
-Status: Feedback
+Status: Open
Bug Type: CGI related
Operating System: Redhat ES3
PHP Version: 4.3.10
New Comment:
True enough, the resource goes from being a stream to an "Unknown".
Unfortunately, my terminal still hangs until the script is complete
when I try to log out of the server. If the stream is truly closed (not
saying I don't believe you ;)), I guess it must be something else. :(
I sense an incoming "bogus"... ;)
Previous Comments:
------------------------------------------------------------------------
[2005-02-25 13:03:46] tony2001@php.net
Why do you think they are not closed?
<?php
var_dump(STDIN);
fclose (STDIN);
var_dump(fread(STDIN, 10));
?>
Or use var_dump() in your example:
<?php
var_dump(STDIN);
fclose (STDIN);
var_dump(STDIN);
?>
------------------------------------------------------------------------
[2005-02-25 12:54:31] php at the-eend dot org
Description:
------------
This is the same bug as reported and fixed for PHP5 last year:
http://bugs.php.net/bug.php?id=27865 , but is
still present in 4.3.10.
Upgrading to PHP 5 is not an option at this point. Any chance this can
be back-ported?
With CLI scripts, fclosing STDIN, STDOUT and STDERR have no effect,
leaving the sockets open, and the terminal which ran the script
hanging.
Reproduce code:
---------------
echo STDIN . '|' . STDOUT . '|' . STDERR . "\n";
fclose (STDIN);
fclose (STDOUT);
fclose (STDERR);
echo STDIN . '|' . STDOUT . '|' . STDERR . "\n";
Expected result:
----------------
The STDIN, STDOUT and STDERR streams should be closed:
Resource id #1|Resource id #2|Resource id #3
||
(perhaps, though this would mean the value of a 'constant' was being
changed...)
Actual result:
--------------
The streams are not closed, and remain pointing to the same resources:
Resource id #1|Resource id #2|Resource id #3
Resource id #1|Resource id #2|Resource id #3
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32107&edit=1