浏览代码

Prevent exception when glob fails to return an array, fixes #1357

Jordi Boggiano 12 年之前
父节点
当前提交
488624675c
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      src/Composer/Factory.php

+ 4 - 2
src/Composer/Factory.php

@@ -100,8 +100,10 @@ class Factory
                             continue;
                         }
                     }
-                    foreach (glob($oldPathMatch) as $child) {
-                        @rename($child, $dir.'/'.basename($child));
+                    if (is_array($children = glob($oldPathMatch))) {
+                        foreach ($children as $child) {
+                            @rename($child, $dir.'/'.basename($child));
+                        }
                     }
                     @unlink($oldPath);
                 }