-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Added missing is_array check #1249
Conversation
As per error coming from Travis CI
I am not entirely certain what is happening here. Can you provide a repeatable test case? |
Sorry, I'll see if I can explain a bit more. I'm using the API client to make queries to YouTube Analytics in a system built on Yii2, as follows: In the Yii controller constructor:
Then the actual query:
I'm condensing it a bit but that's more or less how it goes. I found that the Oauth handshake worked fine, getting and using refresh tokens worked fine, but no other queries to the API worked. Line 275 in src/Google/Service/Resource.php has the following check: The problem is that if At line 280: This assumes Again I'm not completely sure if setting |
A better solution would be to check if if (is_array($paramSpec['values'])) {
$queryVars[] = array_map(
'rawurlencode',
array_map(
'rawurldecode',
$paramSpec['values']
)
);
} |
Nevermind, I think the best thing to do here is just remove the |
Removed the is_array check and the isset($paramSpec['repeated']) check.
However it gets fixed doesn't matter to me :P I've made that change in the patch. |
Okay, in Resources.php, it's possible for
$paramSpec['repeated']
to not be set while$paramSpec['value']
is an array. This causes execution to fall through to line 280 and then throw a warning onrawurldecode($paramSpec['value'])
, which expects a string, and then the request to the API will fail.Checking if
$paramSpec['value']
is an array and then setting it to the first element if so solves the problem.Not sure if this is the best solution, it's just the one I'm using right now to get the thing working at all.