-
-
Notifications
You must be signed in to change notification settings - Fork 877
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
fix order of user_error() and bitmap reset #1313
Conversation
Hmm. If execution stops, the value of bitmap is irrelevant. Can you elaborate? |
0c26415 went into 1.0, so this should too. |
Feel free to rebase onto 1.0. Patch applies cleanly. |
I'm a bit confused by how the branches relate. First off: I can't rebase onto 1.0 cleanly. It gives me a lot of conflicts to resolve. It would be faster if I got a new branch from 1.0 and manually fix the thing. I can do that. But next: on 2.0 there are, as you can see in this PR, 4 places where there is this order of error and reset, but on 1.0 there is just one. Fixing this for 1.0 won't fix those cases in 2.0, and the package I'm using in my project is using 2.0 (per it's composer.json). The problem I try to solve is described in short in #1298 and more in dept in thephpleague/flysystem-sftp#66. It's not really that the execution stops, but it throws, which means the next line won't run. If the throw is caught, I think there is no harm in first doing the I can give you steps to reproduce if you want. |
Steps to reproduce:
Now, exit
Which means: in a long-running queue worker when connection has dropped due to a night of no-activity, failed jobs that are retried will start working again. Also: the first job of the day fails, but next jobs will have connection again. |
@sebsel Thanks a lot for your detailed explanation.
The idea is to forward merge 1.0 into 2.0 into master.
You're absolutely right. I was confused because cherry-picking the commit onto 1.0 does not result in conflicts. I've submitted PR #1314 for 1.0.
I am fine with this. However ...
I think, if the behaviour of user_error() is not reliable, we should not use it in the first place. |
fix order of user_error() and bitmap reset * sebsel/fix/user_error: fix order of user_error() and bitmap reset
Great, master already uses exceptions. |
The issue is presumably due to the use of a custom error handler. Consider the following code: <?php
function error_handler($errno, $errstr, $errfile, $errline)
{
exit("all done!\n");
}
set_error_handler('error_handler');
trigger_error('sample error', E_USER_NOTICE);
echo "this far\n"; The "this far" never gets output whereas the "all done!" does. |
In some configurations of PHP (at least in mine), execution stops after a
user_error()
, so the bitmap is never set to 0 in that case. I think it's best just always first set the bitmap and then do the error.