Skip to content

Fix #72409 - return previous handler #1978

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

Closed
wants to merge 2 commits into from
Closed

Conversation

bp1222
Copy link
Contributor

@bp1222 bp1222 commented Jul 2, 2016

This patch addresses https://bugs.php.net/bug.php?id=72409
It does alter default behavior in a potentially BC-incompatable
means. In the event someone was === true, the return value
of pcntl_signal(). However, this change could be applied to
master with small changes.

This patch is applied to master compared to PR #1952 which was
patching 5.6.x branch of PHP

This patch addresses https://bugs.php.net/bug.php?id=72409
It does alter default behavior in a potentially BC-incompatable
means.  In the event someone was === true, the return value
of pcntl_signal().  However, this change could be applied to
master with small changes.

This patch is applied to master compared to PR#1952 which was
patching 5.6.x branch of PHP
@bishopb
Copy link
Contributor

bishopb commented Jul 4, 2016

I'm not opposed to the BC break, but for consideration to address the breakage, a new function that returns the current handler assignment (\SIG_DFL, \SIG_IGN, or callable):

$oact = pcntl_signal_handler($signo);
pcntl_signal($signo, $nact);
// ... 
pcntl_signal($signo, $oact);

@trowski
Copy link
Member

trowski commented Jul 5, 2016

After some discussion, I think a better direction would be an additional function, pcntl_signal_get_handler().

@weltling Would it be acceptable to add this function to 7.0 as well?

Per comments on this bug-fix, I have added a new function
to get the currently defiend signal handler.  In doing so
we need to change pcntl_signal to store the long value
if a user uses \SIG_DFL or \SIG_IGN.  If unset, \SIG_DFL
is returned.
@bp1222
Copy link
Contributor Author

bp1222 commented Jul 5, 2016

Should this function be in-addition-to, or instead of returning the old-act form pcntl_signal?

@trowski
Copy link
Member

trowski commented Jul 5, 2016

@bp1222 Instead of returning the old value from pcntl_signal(). That function should be unchanged.

@trowski
Copy link
Member

trowski commented Jul 5, 2016

@bp1222 Can you open a clean PR with just what's needed for the getter function? Then this can be merged.

@bp1222
Copy link
Contributor Author

bp1222 commented Jul 5, 2016

Will do. Closing this one now, will submit new in a bit.

@bp1222 bp1222 closed this Jul 5, 2016
bp1222 added a commit to bp1222/php-src that referenced this pull request Jul 5, 2016
This patch addresses https://bugs.php.net/bug.php?id=72409

This patch is applied to master compared to PR#1952 which was
patching 5.6.x branch of PHP

This patch takes into account discussions on PR php#1978
Addressing that rather than have pcntl_signal() return a value
to create a new function that can be used to get the current
value of the signal handler.
@bp1222 bp1222 deleted the fix2-74209 branch July 5, 2016 20:41
php-pulls pushed a commit that referenced this pull request Jul 6, 2016
This patch addresses https://bugs.php.net/bug.php?id=72409

This patch is applied to master compared to PR#1952 which was
patching 5.6.x branch of PHP

This patch takes into account discussions on PR #1978
Addressing that rather than have pcntl_signal() return a value
to create a new function that can be used to get the current
value of the signal handler.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants