Skip to content

Fix #72409 - return previous handler #1952

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 1 commit into from
Closed

Conversation

bp1222
Copy link
Contributor

@bp1222 bp1222 commented Jun 21, 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 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.
@trowski
Copy link
Member

trowski commented Jul 2, 2016

@bp1222 I think the patch should return \SIG_DFL if the previous handler is null. This would eliminate some userland logic when restoring the previous handler. Sorry, I thought \SIG_DFL was a non-zero integer... turns out it is 0. Returning true is better for BC. Either that or \SIG_DFL should be redefined to something else (e.g. 2).

@krakjoe @dshafik Could we consider merging this for 7.1? It can't go into an prior version as it does have a BC break against === true return value checks.

@bp1222
Copy link
Contributor Author

bp1222 commented Jul 2, 2016

It is a weird sitch. Since SIG_DFL, in signal.h is a functionptr, and pcntl is just casting it to a zend_long. I wouldn't want to have PHP's SIG_DFL be some arbitrary number to handle this case.

However, we could just document that the return value will be false on error, true on first set, and callable when overriding. Does that involve some aspect of user management? Maybe. Not sure if ugly or not, but if $handler === true, we could assume SIG_DFL. But that's also a bit clunky. So I'd opt to leave it kindof as-is where if you set a callable, it'd return the callable, else true.

@bp1222
Copy link
Contributor Author

bp1222 commented Jul 2, 2016

I will re-write this to patch master .. as I assumed, it probably wouldn't want to be applied to the 5.6.x branches from the BC problem

@bp1222 bp1222 closed this Jul 2, 2016
@bp1222 bp1222 deleted the fix-74209 branch July 5, 2016 20:41
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.

2 participants