Skip to content
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

Warning on Result constructor #146

Open
alopex06 opened this issue Oct 5, 2016 · 5 comments
Open

Warning on Result constructor #146

alopex06 opened this issue Oct 5, 2016 · 5 comments

Comments

@alopex06
Copy link

alopex06 commented Oct 5, 2016

Argument 1 passed to chobie\Jira\Api\Result::__construct() must be of the type array, null given, called in /Jira/Api.php on line 748 and defined

I think this happens in https://github.com/chobie/jira-api-restclient/blob/master/src/Jira/Api.php#L748:
return new Result($json);

The $json is not an array because some results are null for example for:
Api->search() called by Walker.php if nothing is found.

@aik099
Copy link
Collaborator

aik099 commented Oct 5, 2016

That is quite strange considering, that Walker is used a lot and nobody haven't reported any warning so far.

Are you sure this isn't because of an error on JIRA side, that haven't resulted in exception and popped back up as a warning?

@lookyman
Copy link

I recently started getting tons of this very error. We did migrate Jira to a different infrastructure, so it might be related.

@aik099
Copy link
Collaborator

aik099 commented May 23, 2017

@lookyman , can you please attach some stack trace if possible from place where that warning happens?

@aik099
Copy link
Collaborator

aik099 commented May 23, 2017

I've added array typehint to Result class constructor in 4812b0f because constructor itself was threating data as an array in the first place. It seems, that some of JIRA calls wrapped with Result class doesn't return array as they should.

Also there might be an error during JSON decoding of JIRA response that causes null to happen.

I'm OK with removing typehint, but I need few cases where this would help so that test suite can be updated.

@lookyman
Copy link

I'll look into it.

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

No branches or pull requests

3 participants