jira-api-restclient icon indicating copy to clipboard operation
jira-api-restclient copied to clipboard

Warning on Result constructor

Open alopex06 opened this issue 9 years ago • 6 comments

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.

alopex06 avatar Oct 05 '16 08:10 alopex06

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?

aik099 avatar Oct 05 '16 09:10 aik099

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

lookyman avatar May 23 '17 08:05 lookyman

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

aik099 avatar May 23 '17 08:05 aik099

I've added array typehint to Result class constructor in 4812b0f1fb9817b62e304e4c3200b0269137b151 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.

aik099 avatar May 23 '17 09:05 aik099

I'll look into it.

lookyman avatar May 23 '17 09:05 lookyman