Use \Closure instead of callable - fix #401 #403
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR #398 fixed and issue with Laravel Vapor, but changed
\Closure
usage to callable.Problem is Laravel Event Dispatcher treats
\Closure
...https://github.com/laravel/framework/blob/c7824d4e163947331d2676dc35213126499736a1/src/Illuminate/Events/Dispatcher.php#L79-L81
... differently than callables ...
https://github.com/laravel/framework/blob/c7824d4e163947331d2676dc35213126499736a1/src/Illuminate/Events/Dispatcher.php#L87-L93
... as such
$this
refers to different objects when using these two different syntax.both snippets are from the same
Dispatcher@listen
methodwhich causes issues with queued jobs as reported in #401
For example after updating to 2.11.1 I got these errors on production:
I reverted back to 2.11.0 to avoid issues.
This PR keeps the Vapor related changes from PR #398 (not using the
looping
listener) but reverts to call$this->resetFlare();
from within a\Closure
(anonymous function) so the$this
context is preserved.I didn't added any automated tests as this was an emergency or hot fix to #401 but I tested manually symlinking the fixed repo to my local app.
(closes #401)