-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Allow resetting the error handler #18
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
This allows the error handler to be reset using set_error_handler(null). As the code suggests this behavior was already previously intended, but the callback check was done too strictly.
Hi, I attached another fix, this will save one alloc/free pair, and also save one (IS_NULL == Z_TYPE_P(error_handler). Nikic, if you have no objection, I will commit the patch. and later, also improve the set_exception_handler. thanks |
since I will offline for maybe two days, I commited, if you have any question, plz write me :) thanks |
Comment on behalf of laruence at php.net: implemented |
Comment on behalf of laruence at php.net: seems I can not close this pull request via qa.php.net |
@laruence I wanted to submit another PR which makes set_error_handler(null) return the previous error handler instead of just true. That's why I left the code intact, as it was easier to implement with the old code structure. |
set_error_handler(null) should return previous one just like all others. If it's not so with new patch, should be fixed. |
On Sat, Mar 24, 2012 at 4:48 PM, Stanislav Malyshev
thanks
惠新宸 laruence |
On Sat, Mar 24, 2012 at 4:21 PM, nikic
I don't think that should be done, since set_exception_handler return thanks
惠新宸 laruence |
On Sat, Mar 24, 2012 at 4:21 PM, nikic
And, I really don't think your new PR should relay on a code thanks
惠新宸 laruence |
I have no idea why set_exception_handler() returns true in this case, makes very little sense. |
On Sat, Mar 24, 2012 at 5:50 PM, Stanislav Malyshev
In this fix, I made them consistent. if we decide to change the return value, then set_exception_handler thanks
Laruence Xinchen Hui |
This is why changes like this should be done in a branch, announced on the list and discussed, not put into stable branch first and discussed later. |
On Sat, Mar 24, 2012 at 6:02 PM, Stanislav Malyshev
what change? you mean "allow NULL value pass to set_error_handler"? I think this is a little change, so I committed it, but yeah, if thanks
惠新宸 laruence |
first, it's not a little change, it changes a lot in this function. Second, I'm not sure these functions should work this way, and I see no reason to rush with it without discussion. Please revert it for from 5.4, put it into a feature branch and let's see what's the best way to take there. |
On Sat, Mar 24, 2012 at 6:11 PM, Stanislav Malyshev
okey, how about the previous one: "improve set_exception_handler", thanks
惠新宸 laruence |
Sorry for causing all this confusion. I'll create a new PR which will include all changes including the fix for the return value and the memory leak which currently exists in these functions. |
Hi: Reverted. both the two changes, then committed to trunk only . thanks On Sat, Mar 24, 2012 at 6:14 PM, Xinchen Hui
Laruence Xinchen Hui |
Nikic: np, it's alright, we always doing commit/revert.. :) thanks On Sat, Mar 24, 2012 at 7:43 PM, nikic
惠新宸 laruence |
This allows the error handler to be reset using set_error_handler(null). As the code suggests this behavior was already previously intended, but the callback check was done too strictly.
See also bug https://bugs.php.net/bug.php?id=60738.
PS: I replaced the
!zend_is_true
with a strict null check to be consistent with the behavior ofset_exception_handler
.