浏览代码

Only check phar validity if phar.readonly is false

Jordi Boggiano 11 年之前
父节点
当前提交
3251f9f1aa
共有 1 个文件被更改,包括 6 次插入5 次删除
  1. 6 5
      src/Composer/Command/SelfUpdateCommand.php

+ 6 - 5
src/Composer/Command/SelfUpdateCommand.php

@@ -174,17 +174,18 @@ EOT
     {
     {
         try {
         try {
             @chmod($newFilename, 0777 & ~umask());
             @chmod($newFilename, 0777 & ~umask());
-            // test the phar validity
-            $phar = new \Phar($newFilename);
-            // free the variable to unlock the file
-            unset($phar);
+            if (!ini_get('phar.readonly')) {
+                // test the phar validity
+                $phar = new \Phar($newFilename);
+                // free the variable to unlock the file
+                unset($phar);
+            }
 
 
             // copy current file into installations dir
             // copy current file into installations dir
             if ($backupTarget && file_exists($localFilename)) {
             if ($backupTarget && file_exists($localFilename)) {
                 @copy($localFilename, $backupTarget);
                 @copy($localFilename, $backupTarget);
             }
             }
 
 
-            unset($phar);
             rename($newFilename, $localFilename);
             rename($newFilename, $localFilename);
         } catch (\Exception $e) {
         } catch (\Exception $e) {
             if ($backupTarget) {
             if ($backupTarget) {