Skip to content
This repository was archived by the owner on Nov 14, 2019. It is now read-only.

Commit 1408999

Browse files
committed
bug #120 fix handling of missing patch version (xabbuh)
This PR was merged into the 1.0-dev branch. Discussion ---------- fix handling of missing patch version When the user tried to install the Symfony Standard Edition with just specifying the minor version (like `symfony new blog 2.3`), the installer failed for two reasons: * The `use` statement for the `Client` class was missing when it was used to download the list of available versions from symfony.com. * The URL from where the archive should be downloaded was build before the patch version was evaluated. Therefore, the archive of the actual Symfony version to be installed could not be found (it was tried to download an archive for `2.3` while the archive actually had to be referenced for `2.3.26`). This fixes #119. Commits ------- 52ad07c fix handling of missing patch version
2 parents 859cd90 + 52ad07c commit 1408999

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Symfony/Installer/NewCommand.php

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Installer;
1313

14+
use GuzzleHttp\Client;
1415
use Symfony\Component\Console\Input\InputArgument;
1516
use Symfony\Component\Console\Input\InputInterface;
1617
use Symfony\Component\Console\Output\OutputInterface;
@@ -53,7 +54,6 @@ protected function initialize(InputInterface $input, OutputInterface $output)
5354
$this->projectDir = $this->fs->isAbsolutePath($directory) ? $directory : getcwd().DIRECTORY_SEPARATOR.$directory;
5455
$this->projectName = basename($directory);
5556
$this->version = trim($input->getArgument('version'));
56-
$this->remoteFileUrl = 'http://symfony.com/download?v=Symfony_Standard_Vendors_'.$this->version;
5757
}
5858

5959
protected function execute(InputInterface $input, OutputInterface $output)
@@ -62,6 +62,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
6262
$this
6363
->checkProjectName()
6464
->checkSymfonyVersionIsInstallable()
65+
->initializeRemoteFileUrl()
6566
->download()
6667
->extract()
6768
->cleanUp()
@@ -382,4 +383,16 @@ protected function generateComposerProjectName()
382383

383384
return $name;
384385
}
386+
387+
/**
388+
* Builds the URL of the archive to download based on the validated version number.
389+
*
390+
* @return NewCommand
391+
*/
392+
private function initializeRemoteFileUrl()
393+
{
394+
$this->remoteFileUrl = 'http://symfony.com/download?v=Symfony_Standard_Vendors_'.$this->version;
395+
396+
return $this;
397+
}
385398
}

0 commit comments

Comments
 (0)