-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Don't register signal handlers if pcntl is disabled #38589
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
Conversation
7231ead
to
2970f34
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it 👍🏼
src/Symfony/Component/Console/SignalRegistry/SignalRegistry.php
Outdated
Show resolved
Hide resolved
1fe2517
to
1c0e10c
Compare
1c0e10c
to
8fe8763
Compare
Thank you @chalasr. |
$this->signalRegistry = new SignalRegistry(); | ||
if (\defined('SIGINT')) { | ||
if (\defined('SIGINT') && SignalRegistry::isSupported()) { | ||
$this->signalRegistry = new SignalRegistry(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late review, but the PR has changed before my review.
So here we go:
This change is wrong. See getSignalRegistry()
method:
https://github.com/chalasr/symfony/blob/8fe876341e860ea3fa13bec3c2bdf77a66ead424/src/Symfony/Component/Console/Application.php#L111-L114
Then, a lot of fatal error could occurs since the registry might not be defined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, thank you; #38602 makes it nullable
This PR was merged into the 5.x branch. Discussion ---------- [Console] Fix signal management | Q | A | ------------- | --- | Branch? | 5.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Missed in #38589 Commits ------- 36e41b8 [Console] Fix Application::getSignalRegistry() retval
This PR skips the default signal registration when pcntl is not installed or disabled via the
disable_functions
INI directive (which is common for prod infrastructures).When registering a
SignalableCommand
, a clear exception is thrown.Best reviewed without whitespaces