|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8624 fail to open "php://stderr"
Submitted: 2001-01-09 20:07 UTC Modified: 2001-06-22 03:07 UTC
From: Tomas V dot V dot Cox <cox at idecnet dot com> Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 4.0.4 OS: Linux Red Hat 6.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: Tomas V dot V dot Cox <cox at idecnet dot com>
New email:
PHP Version: OS:


 [2001-01-09 20:07 UTC] Tomas V dot V dot Cox <cox at idecnet dot com>
The second time I try to open and close the "php://stderr" file descriptor, PHP begins to fail. It doesn't occur with standar files.

You can test the error with the script:
#!/usr/bin/php -q
function myerror ($error){
	if (!$errfd = @fopen("php://stderr", "w+")){
		echo "Can not open\n";
	fwrite ($errfd, $error);
	fclose ($errfd);

for ($i=0; $i<=3; $i++){
	myerror("this is error num: $i\n");

The output:
this is error num: 0
Can not open
Can not open
Can not open

The error:
<b>Warning</b>:  fopen("php://stderr","w") - Bad file descriptor in <b>./test.php</b> on line <b>3</b><br>
<b>Warning</b>:  Supplied argument is not a valid File-Handle resource in <b>./test.php</b> on line <b>4</b><br>


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-22 03:07 UTC]
A fix for this has been committed. The fix will appear in PHP 4.0.7. Thanks for your report.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Feb 01 07:05:52 2023 UTC