Browse Source

Error out on wrong bin config

Jordi Boggiano 13 năm trước cách đây
mục cha
commit
6a50dbd46d
1 tập tin đã thay đổi với 4 bổ sung1 xóa
  1. 4 1
      src/Composer/Package/Loader/ArrayLoader.php

+ 4 - 1
src/Composer/Package/Loader/ArrayLoader.php

@@ -58,7 +58,10 @@ class ArrayLoader
             $package->setExtra($config['extra']);
         }
 
-        if (isset($config['bin']) && is_array($config['bin'])) {
+        if (isset($config['bin'])) {
+            if (!is_array($config['bin'])) {
+                throw new \UnexpectedValueException('Package '.$config['name'].'\'s bin key should be an array, '.gettype($config['bin']).' given.');
+            }
             foreach ($config['bin'] as $key => $bin) {
                 $config['bin'][$key]= ltrim($bin, '/');
             }