-
Notifications
You must be signed in to change notification settings - Fork 40
Security Advisory: json_decode() expects parameter 1 to be string, array given #43
Conversation
|
Hmm, that sounds like a configuration error on your side, or SecurityAdvisory version incompatibility. We'll need more info to investigate. |
|
@Thinkscape What kind of info are you expecting? |
|
Anything that will help :-) Try to create a reproduce scenario, ideally send a PR with a test that shows the problem. |
|
@Thinkscape OKey, it looks like this:
I hope it will be helpful :] |
|
Does that mean you're trying to run the check with invalid (empty, missing) advisories ? |
|
Do you mean the |
|
@Thinkscape Do you know how to solve this problem? |
|
The problem still exists. I'm using the latest version (dev-master 23998e7). Are you going to solve this problem? |
|
It looks like we could solve the issue as follows: $advisories = $this->securityChecker->check($this->lockFilePath, 'json');
if (is_string($advisories)) {
$advisories = @json_decode($advisories);
}
if (! is_array($advisories)) {
return new Warning('Could not parse response from security advisory service.');
}
/* ... continue on ... */I'll create a PR for this for you to test, @kniziol . |
- Ensures that we can use either native PHP code returned by the security checker, or JSON.
|
@kniziol you can test this pull request. :) |
|
@weierophinney thanks. It looks good and the problem is gone. Details:
|
|
Merged, and tagged 1.0.3 so this will be picked up in stable versions. |
|
Thx. On Monday, August 11, 2014, weierophinney [email protected] wrote:
[email protected] |
Problem:
monitor:healthWARNING Security Advisory: json_decode() expects parameter 1 to be string, array givenSolution:
Remove
$advisories = @json_decode($advisories);inZendDiagnostics\Check\SecurityAdvisoryand the warning is gone.