Parcourir la source

Merge pull request #3238 from stof/patch-6

Fixed the registration of commands with invalid JSON file
Jordi Boggiano il y a 10 ans
Parent
commit
f7a84e423d
1 fichiers modifiés avec 1 ajouts et 2 suppressions
  1. 1 2
      src/Composer/Console/Application.php

+ 1 - 2
src/Composer/Console/Application.php

@@ -113,8 +113,7 @@ class Application extends BaseApplication
 
         // add non-standard scripts as own commands
         $file = Factory::getComposerFile();
-        $json = new JsonFile($file);
-        if ($json->exists() && is_readable($file) && ($composer = $json->read())) {
+        if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
             if (isset($composer['scripts']) && is_array($composer['scripts'])) {
                 foreach ($composer['scripts'] as $script => $dummy) {
                     if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {