Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Add fix for #619 #636

Open
wants to merge 1 commit into
base: 5.x
Choose a base branch
from
Open

Add fix for #619 #636

wants to merge 1 commit into from

Conversation

SammyK
Copy link
Contributor

@SammyK SammyK commented Aug 19, 2016

I've tried my darnedest to replicate the issue in #619, but I can't replicate it for the life of me. I was thinking it was because of timeouts where the response will be null, but it handles null responses just fine.

I'm thinking this has to be an extreme edge case. At any rate, I added this little patch to keep error messages from being generated if the edge case happens again.

@yguedidi - what do you think? :)

@ghost ghost added the CLA Signed label Aug 19, 2016
@yguedidi
Copy link
Contributor

This looks weird to me... I'm 👎 on this solution

The error means that we receive a response that does not have a corresponding request (or at least a corresponding response we do not found).

I think it is better to decide what to do in this case:

  • throwing an exception
  • allow responses to be created without request

Any preference? :)

@SammyK
Copy link
Contributor Author

SammyK commented Aug 20, 2016

I'm cool with throwing an exception. But in what scenario would that happen? I tried to trigger the error by manually throwing invalid values at it but I couldn't trigger it! :)

@yguedidi
Copy link
Contributor

OMG!!! @SammyK I think I got it! Not tried yet (late night idea), but I think this can happen due to the limit of 50 requests per batch request. 😄

@SammyK
Copy link
Contributor Author

SammyK commented Mar 19, 2017

That's so awesome! Nice job @yguedidi! And thanks for knocking out some of these issues! I've been pretty swamped lately so I'm looking forward to getting some time to work on the SDK when things let up! :)

@yguedidi yguedidi changed the base branch from master to 5.x December 3, 2017 22:52
Copy link
Contributor

@yguedidi yguedidi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According my suggestion, I thing the doc should be updated, as well as the changelog and tests :)

@@ -98,7 +98,7 @@ public function setResponses(array $responses)
public function addResponse($key, $response)
{
$originalRequestName = isset($this->batchRequest[$key]['name']) ? $this->batchRequest[$key]['name'] : $key;
$originalRequest = isset($this->batchRequest[$key]['request']) ? $this->batchRequest[$key]['request'] : null;
$originalRequest = isset($this->batchRequest[$key]['request']) ? $this->batchRequest[$key]['request'] : new FacebookRequest;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of a FacebookRequest, I'd use an UnknownFacebookRequest which extends FacebookRequest.
That way, we don't break BC, and the user can check with a simple instanceof if the original request is there or not.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants