This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…as array - Callbacks can be strings, objects (functors), or closures, too. - Allow testing against functor callbacks
- Finally determined a way to add a test for this.
- Trailing whitespace
I've added code that does the following:
The test added did indeed display an error before the fix, and now does not. |
@@ -176,11 +176,22 @@ protected function detachProblemListeners(SharedEvents $sharedEvents) | |||
$events = $sharedEvents->getListeners($id, $eventName); | |||
foreach ($events as $currentEvent) { | |||
$currentCallback = $currentEvent->getCallback(); | |||
if (!isset($currentCallback[0])) { | |||
|
|||
// Testing against object callbacks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about rewrite this part with this?
if (is_array($currentCallback)) {
$currentCallback = array_shift($currentCallback);
}
if (!is_object($currentCallback) {
continue;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! Implementing now.
- Simplify logic when introspecting callback
ghost
assigned Maks3w
Nov 12, 2013
Maks3w
added a commit
that referenced
this pull request
Nov 12, 2013
Maks3w
added a commit
that referenced
this pull request
Nov 12, 2013
Maks3w
added a commit
that referenced
this pull request
Nov 12, 2013
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Hi!
I'm playing with apigility and trying to use it with one of my project. But when i try to login in the system i receive the error:
the error occurs inside detachProblemListeners.
If i comment the attacing listener inside the onBootstrap (zfcampus/zf-content-negotiation/src/ZF/ContentNegotiation/Module.php:122) i can login but the api stops working (as expected).
Maybe Forward.php should check if the callback is in fact an array on line 179 (ZF2 2.2.5)? Something like:
Thanks,
Leandro Silva