Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI closes standard streams too early #8575

Closed
morrisonlevi opened this issue May 18, 2022 · 3 comments
Closed

CLI closes standard streams too early #8575

morrisonlevi opened this issue May 18, 2022 · 3 comments

Comments

@morrisonlevi
Copy link
Contributor

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

@iluuu1994
Copy link
Member

Was this solved by #8571? Can this be closed?

@Krakozaber
Copy link

Now he doesn't close it for gitlab CI (but I'm not sure if php is to blame for this)

@cmb69
Copy link
Member

cmb69 commented Jun 20, 2022

Was this solved by #8571? Can this be closed?

It was supposed to be solved by #8569, #8570 and #8571, respectively. However, that had to be reverted due to #8827. And since this ticket number is already listed in the changelog, I'm closing this ticket. Note that there is #8833 which is supposed to provide a proper fix without BC break, but this is highly unlikely to be back-ported to the stable branches. So if the issue at hand needs to addressed in PHP 8.0/8.1, please open a new ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants
@morrisonlevi @iluuu1994 @cmb69 @Krakozaber and others