Problem in CLI

php.internals

Andi Gutmans

22 years ago
The following script: <?php error_reporting(E_ALL); leak(100); print "hello\n"; Doesn't report a leak in CLI mode but it does in CGI. It seems that stderr and stdout file descriptors are getting screwed up in CLI. I remember someone messing around with this. Any ideas? Thanks, Andi

Wez Furlong

22 years ago
When STDERR gets dtor'd, the descriptor is closed, so the leak messages are heading into the void. The reason for the change was so that PHP CLI could be launched from inetd and be able to close descriptors. A (somewhat hacky) fix would be to skip closing the descriptor if it is the stderr descriptor and if PHP is in request shutdown. --Wez.

Andi Gutmans

22 years ago
Why are we creating a resource for these descriptors? Is it for the constants in PHP? Andi At 12:21 PM 5/25/2004 +0100, Wez Furlong wrote:

Wez Furlong

22 years ago
Yes, so you can do stuff like: fwrite(STDERR, "an error!") without having to manually open and pass around the stream handle. --Wez.

Andi Gutmans

22 years ago
Any chance you can dup() it for the STDERR constant? At 01:09 PM 5/25/2004 +0100, Wez Furlong wrote: