From 3251f9f1aa997479fff78905841e22beacfbe37b Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Wed, 16 Apr 2014 10:23:45 +0200 Subject: [PATCH] Only check phar validity if phar.readonly is false --- src/Composer/Command/SelfUpdateCommand.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index a55b9b372..8ce355d9c 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -174,17 +174,18 @@ EOT { try { @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 if ($backupTarget && file_exists($localFilename)) { @copy($localFilename, $backupTarget); } - unset($phar); rename($newFilename, $localFilename); } catch (\Exception $e) { if ($backupTarget) {