Skip to content

Commit

Permalink
Correct json decoding
Browse files Browse the repository at this point in the history
  • Loading branch information
omarlopesino committed Mar 1, 2023
1 parent d6eb645 commit 386b27c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/SecuritiesFixedCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,9 @@ protected function saveComposerCommitStatus(string $commit_id, string $folder) {
*/
protected function getFolderSecurityAdvisoriesByDate(string $folder, string $date) {
$date = new \DateTime($date);
$security_advisories = json_decode($this->runCommandWithKnownException(sprintf('composer audit --locked --working-dir=%s --format=json', $folder))->getOutput());
if (!empty($security_advisories) && isset($security_advisories->advisories)) {
$security_advisories_list_by_package = (array) $security_advisories->advisories;
$security_advisories = json_decode($this->runCommandWithKnownException(sprintf('composer audit --locked --working-dir=%s --format=json', $folder))->getOutput(), TRUE);
if (!empty($security_advisories) && isset($security_advisories['advisories'])) {
$security_advisories_list_by_package = $security_advisories['advisories'];
$security_advisories_list = call_user_func_array('array_merge', array_values($security_advisories_list_by_package));
$security_advisories_list = array_filter($security_advisories_list, function ($advisory) use ($date) {
if (isset($advisory->reportedAt->date)) {
Expand Down

0 comments on commit 386b27c

Please sign in to comment.