Skip to content

Commit

Permalink
Fix PHP warning about reading auth.json file
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Richardson committed Apr 20, 2016
1 parent 250416c commit 77a7490
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Magestead/Helper/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,14 @@ protected function verifyAuth($helper, InputInterface $input, OutputInterface $o
{
$authFile = $_SERVER['HOME'] . "/.composer/auth.json";

$authJson = file_get_contents($authFile);
$authObj = (array)json_decode($authJson);

if (isset($authObj['http-basic']) && isset($authObj['http-basic']->{'repo.magento.com'})) {
return true;
$authObj = [];
if (file_exists($authFile)) {
$authJson = file_get_contents($authFile);
$authObj = (array)json_decode($authJson);

if (isset($authObj['http-basic']) && isset($authObj['http-basic']->{'repo.magento.com'})) {
return true;
}
}

$this->askForAuth($helper, $input, $output);
Expand Down

0 comments on commit 77a7490

Please sign in to comment.