PHP 4.0 Bug #8624: fail to open "php://stderr"
| From: | Tomas V . V . Cox | Date: | Wed, 10 Jan 2001 01:07:27 +0000 |
| Subject: | PHP 4.0 Bug #8624: fail to open "php://stderr" | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-43624@lists.php.net to get a copy of this message | ||
From: Tomas V.V.Cox <cox@idecnet.com>
Operating system: Linux Red Hat 6.1
PHP version: 4.0.4
PHP Bug Type: Filesystem function related
Bug description: fail to open "php://stderr"
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
<?php
function myerror ($error){
if (!$errfd = @fopen("php://stderr", "w+")){
echo "Can not open\n";
return;
}
fwrite ($errfd, $error);
fclose ($errfd);
return;
}
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>
<br>
<b>Warning</b>: Supplied argument is not a valid File-Handle resource in
<b>./test.php</b> on line <b>4</b><br>
<br>
--
Edit Bug report at: http://bugs.php.net/?id=8624&edit=1