From 4685b4bf495a5aef8e5b5384f52153f92b6994fc Mon Sep 17 00:00:00 2001 From: Christophe Coevoet Date: Sun, 5 Oct 2014 14:30:44 +0200 Subject: [PATCH] Fixed the resetting of the json file on removal failures Closes #3329 --- src/Composer/Command/RemoveCommand.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Composer/Command/RemoveCommand.php b/src/Composer/Command/RemoveCommand.php index be110d650..ee1754c65 100755 --- a/src/Composer/Command/RemoveCommand.php +++ b/src/Composer/Command/RemoveCommand.php @@ -59,11 +59,11 @@ EOT $file = Factory::getComposerFile(); - $json = new JsonFile($file); - $composer = $json->read(); - $composerBackup = file_get_contents($json->getPath()); + $jsonFile = new JsonFile($file); + $composer = $jsonFile->read(); + $composerBackup = file_get_contents($jsonFile->getPath()); - $json = new JsonConfigSource($json); + $json = new JsonConfigSource($jsonFile); $type = $input->getOption('dev') ? 'require-dev' : 'require'; $altType = !$input->getOption('dev') ? 'require-dev' : 'require'; @@ -110,7 +110,7 @@ EOT $status = $install->run(); if ($status !== 0) { $output->writeln("\n".'Removal failed, reverting '.$file.' to its original content.'); - file_put_contents($json->getPath(), $composerBackup); + file_put_contents($jsonFile->getPath(), $composerBackup); } return $status;