@@ -128,25 +128,17 @@ private function checkSymfonyVersionIsInstallable()
128
128
throw new \RuntimeException ('The Symfony version should be 2.N or 2.N.M, where N = 0..9 and M = 0..99 ' );
129
129
}
130
130
131
- if (preg_match ('/^2\.\d$/ ' , $ this ->version )) {
131
+ if (preg_match ('/^( 2\.\d\.\d{1,2})|(2\.\d) $/ ' , $ this ->version )) {
132
132
// Check if we have a minor version
133
133
134
- $ json = @file_get_contents ('http://symfony.com/versions.json ' );
134
+ $ client = new Client ();
135
+ $ json = $ client ->get ('http://symfony.com/versions.json ' )->getBody ()->getContents ();
135
136
136
- if (false !== $ json ) {
137
+ if ($ json ) {
137
138
$ versionsList = GuzzleHttp \json_decode ($ json , true );
138
- if (isset ($ versionsList [$ this ->version ]) && in_array ( $ versionsList [ $ this -> version ], $ versionsList [ ' installable ' ]) ) {
139
+ if (isset ($ versionsList [$ this ->version ])) {
139
140
// Get the latest installable of the minor version the user asked
140
141
$ this ->version = $ versionsList [$ this ->version ];
141
- } else {
142
- throw new \RuntimeException (sprintf (
143
- "The selected version (%s) cannot be installed because it is not \n" .
144
- "supported, or is considered as not installable for security reasons. \n" .
145
- "To solve this issue, install Symfony with the latest available version by \n" .
146
- "specifying no version, or simply using \"latest \" keyword as version name: \n%s " ,
147
- $ this ->version ,
148
- $ this ->getExecutedCommand ('latest ' )
149
- ));
150
142
}
151
143
}
152
144
}
@@ -265,7 +257,7 @@ private function download()
265
257
));
266
258
} else {
267
259
throw new \RuntimeException (sprintf (
268
- "The selected version (%s) couldn\ 't be downloaded because of the following error: \n%s " ,
260
+ "The selected version (%s) couldn't be downloaded because of the following error: \n%s " ,
269
261
$ this ->version ,
270
262
$ e ->getMessage ()
271
263
));
0 commit comments