Keep Server Online
  
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
  
or
  
 
  
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
  
Thank You! Steffen
  
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
 |    |   
 | 
     Topic: PHP 7.4 error with php://stderr | 
 |   
| Author | 
  | 
 
mpiche
 
 
  Joined: 10 Apr 2008 Posts: 9
 
  | 
 Posted: Thu 23 Jan '20 19:05    Post subject: PHP 7.4 error with php://stderr | 
     | 
 
  | 
 
Since PHP 7.4, the stream php://stderr is giving me a PHP notice "Bad file descriptor".
 
 
Everything is working fine with PHP 7.3. If i switch to mod_apache I don't have the notice. Also, the notice isn't happening if I run my script directly from the command line. 
 
 
My script is : 
 
	$fp = fopen('php://stderr', 'w');
 
	fwrite($fp, "test\n");
 
 
The result is : 
 
	Notice: fwrite(): write of 5 bytes failed with errno=9 Bad file descriptor in D:\htdocs\test_code\74.php on line 18
 
 
Thanks, | 
 
  | 
 
| Back to top | 
 | 
 
James Blond Moderator
  
  Joined: 19 Jan 2006 Posts: 7442 Location: EU, Germany, Next to Hamburg
  | 
 Posted: Fri 24 Jan '20 11:02    Post subject:  | 
     | 
 
  | 
 
Congratulations you found a bug in PHP 7.4! 
 
 
 	  | Code: | 	 		  
 
error_reporting(E_ALL);
 
ini_set('display_errors','On');
 
$fp = fopen('php://stderr', 'w+');
 
var_dump($fp);
 
fwrite($fp, "test\n");
 
 | 	  
 
 
the var_dump shows that it is a valid stream. | 
 
  | 
 
| Back to top | 
 | 
 
mpiche
 
 
  Joined: 10 Apr 2008 Posts: 9
 
  | 
 Posted: Fri 24 Jan '20 15:52    Post subject:  | 
     | 
 
  | 
 
| Thanks ! I have send a bug report on php website. | 
 
  | 
 
| Back to top | 
 | 
 
 
 
 
 | 
 
 
 |  
 
 |  
  |   
 |