Description
Description
This only affects extensions which might print to stderr (or stdout)
after request shutdown, so prshutdown, mshutdown, and gshutdown, as
well as the equivalent zend_extension shutdown.
There's no need to close the file handles stin, stdout, and stderr nor
their equivalent file descriptors (unless you dup them, then you need
to close the dup).
I hit this when trying to debug PHP lifecycle issues and nothing after
request shutdown was showing up. In the case of one extension that was
using a Rust library to print colored debug messages, it would panic
because the library didn't expect stderr to actually get closed.
Although the library should be more cautious, there's no need to close
these streams.
There are already two cases where we don't close these files: debug
builds and if --repeat
is used.
I already have patches for this, expect to merge them shortly but
wanted to have an issue number to use for the test.
PHP Version
Has been an issue at least as far back as PHP 5.4, still present on PHP 8.1.
Operating System
No response