Uh oh!
There was an error while loading. Please reload this page.
[CLI] Stop closing standard streams - #8571
Conversation
e8eb980 to
b9003e8CompareExtensions may (and do) write to stderr in mshutdown and similar. In the best case, with the stderr stream closed, it's just swallowed. However, some libraries will do things like try to detect color, and these will outright fail and cause an error path to be taken.
b9003e8 to
e463fc4CompareExtensions may (and do) write to stderr in mshutdown and similar. In the best case, with the stderr stream closed, it's just swallowed. However, some libraries will do things like try to detect color, and these will outright fail and cause an error path to be taken.
arnaud-lb
commented
May 20, 2022
Thank you for these changes @morrisonlevi Merged in c53c3e2 |
moonlitbugs
commented
Jun 9, 2022
This PR has just appeared in PHP-8.1.7, and has left me with a small farm of non-booting servers. 👎 A few lines of code will probably be worth several thousand words, so let me give that a whirl: And in in With php-8.1.7, the shell script that copies output to a log file never returns, because the I have edited my php-8.1.7 tarball, replacing sapi/cli/php_cli.c with the version from 8.1.6; this workaround fixes this regression. |
iluuu1994
commented
Jun 17, 2022
@morrisonlevi Can you comment on the above? @moonlitbugs Can you create a new issue? |
bukka
commented
Jun 20, 2022
I had a look on this and the problem is obviously that this prevented user to close those streams explicitly which is a regression so we need to revert this from lower branches. I'm not sure if we should even treat this as a bug as it's kind of excepted that that the stream might get closed and the extension should not relay on it being open. That said I think we could make the live for extensions better by not to close it on non explicit closing (just as a feature in master). I think potentially better solution would be to have a different flag in streams that would prevent just closing the streams on resource dtor. I created an initial not properly tested changes that potentially not handle some edge cases yet (e.g. enclosed steams) in #8833 . I might also need to introduce a different option to add to fclose if this proves not to work correctly. But it should be doable. |
Extensions may (and do) write to stderr in mshutdown and similar. In the best case, with the stderr stream closed, it's just swallowed. However, some libraries will do things like try to detect color, and these will outright fail and cause an error path to be taken.
Extensions may (and do) write to stderr in mshutdown and similar. In
the best case, with the stderr stream closed, it's just swallowed.
However, some libraries will do things like try to detect color, and
these will outright fail and cause an error path to be taken.
See also #8569 and #8570.