Skip to content

Commit 04629ec

Browse files
angelussAlex Deemann
authored andcommitted
Update vendors to latest minor versions
1 parent c9388ab commit 04629ec

File tree

4 files changed

+897
-536
lines changed

4 files changed

+897
-536
lines changed

app/SymfonyRequirements.php

Lines changed: 85 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ public function __construct($cfgName, $evaluation, $approveCfgAbsence = false, $
168168
*/
169169
class RequirementCollection implements IteratorAggregate
170170
{
171+
/**
172+
* @var Requirement[]
173+
*/
171174
private $requirements = array();
172175

173176
/**
@@ -265,7 +268,7 @@ public function addCollection(RequirementCollection $collection)
265268
/**
266269
* Returns both requirements and recommendations.
267270
*
268-
* @return array Array of Requirement instances
271+
* @return Requirement[]
269272
*/
270273
public function all()
271274
{
@@ -275,7 +278,7 @@ public function all()
275278
/**
276279
* Returns all mandatory requirements.
277280
*
278-
* @return array Array of Requirement instances
281+
* @return Requirement[]
279282
*/
280283
public function getRequirements()
281284
{
@@ -292,7 +295,7 @@ public function getRequirements()
292295
/**
293296
* Returns the mandatory requirements that were not met.
294297
*
295-
* @return array Array of Requirement instances
298+
* @return Requirement[]
296299
*/
297300
public function getFailedRequirements()
298301
{
@@ -309,7 +312,7 @@ public function getFailedRequirements()
309312
/**
310313
* Returns all optional recommendations.
311314
*
312-
* @return array Array of Requirement instances
315+
* @return Requirement[]
313316
*/
314317
public function getRecommendations()
315318
{
@@ -326,7 +329,7 @@ public function getRecommendations()
326329
/**
327330
* Returns the recommendations that were not met.
328331
*
329-
* @return array Array of Requirement instances
332+
* @return Requirement[]
330333
*/
331334
public function getFailedRecommendations()
332335
{
@@ -376,7 +379,8 @@ public function getPhpIniConfigPath()
376379
*/
377380
class SymfonyRequirements extends RequirementCollection
378381
{
379-
const REQUIRED_PHP_VERSION = '5.3.3';
382+
const LEGACY_REQUIRED_PHP_VERSION = '5.3.3';
383+
const REQUIRED_PHP_VERSION = '5.5.9';
380384

381385
/**
382386
* Constructor that initializes the requirements.
@@ -385,17 +389,27 @@ public function __construct()
385389
{
386390
/* mandatory requirements follow */
387391

388-
$installedPhpVersion = phpversion();
392+
$installedPhpVersion = PHP_VERSION;
393+
$requiredPhpVersion = $this->getPhpRequiredVersion();
389394

390-
$this->addRequirement(
391-
version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>='),
392-
sprintf('PHP version must be at least %s (%s installed)', self::REQUIRED_PHP_VERSION, $installedPhpVersion),
393-
sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
394-
Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
395-
$installedPhpVersion, self::REQUIRED_PHP_VERSION),
396-
sprintf('Install PHP %s or newer (installed version is %s)', self::REQUIRED_PHP_VERSION, $installedPhpVersion)
395+
$this->addRecommendation(
396+
$requiredPhpVersion,
397+
'Vendors should be installed in order to check all requirements.',
398+
'Run the <code>composer install</code> command.',
399+
'Run the "composer install" command.'
397400
);
398401

402+
if (false !== $requiredPhpVersion) {
403+
$this->addRequirement(
404+
version_compare($installedPhpVersion, $requiredPhpVersion, '>='),
405+
sprintf('PHP version must be at least %s (%s installed)', $requiredPhpVersion, $installedPhpVersion),
406+
sprintf('You are running PHP version "<strong>%s</strong>", but Symfony needs at least PHP "<strong>%s</strong>" to run.
407+
Before using Symfony, upgrade your PHP installation, preferably to the latest version.',
408+
$installedPhpVersion, $requiredPhpVersion),
409+
sprintf('Install PHP %s or newer (installed version is %s)', $requiredPhpVersion, $installedPhpVersion)
410+
);
411+
}
412+
399413
$this->addRequirement(
400414
version_compare($installedPhpVersion, '5.3.16', '!='),
401415
'PHP version must not be 5.3.16 as Symfony won\'t work properly with it',
@@ -425,22 +439,17 @@ public function __construct()
425439
'Change the permissions of either "<strong>app/logs/</strong>" or "<strong>var/logs/</strong>" directory so that the web server can write into it.'
426440
);
427441

428-
$this->addPhpIniRequirement(
429-
'date.timezone', true, false,
430-
'date.timezone setting must be set',
431-
'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
432-
);
433-
434-
if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) {
435-
$timezones = array();
436-
foreach (DateTimeZone::listAbbreviations() as $abbreviations) {
437-
foreach ($abbreviations as $abbreviation) {
438-
$timezones[$abbreviation['timezone_id']] = true;
439-
}
440-
}
442+
if (version_compare($installedPhpVersion, '7.0.0', '<')) {
443+
$this->addPhpIniRequirement(
444+
'date.timezone', true, false,
445+
'date.timezone setting must be set',
446+
'Set the "<strong>date.timezone</strong>" setting in php.ini<a href="#phpini">*</a> (like Europe/Paris).'
447+
);
448+
}
441449

450+
if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) {
442451
$this->addRequirement(
443-
isset($timezones[@date_default_timezone_get()]),
452+
in_array(@date_default_timezone_get(), DateTimeZone::listIdentifiers(), true),
444453
sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()),
445454
'Your default timezone is not supported by PHP. Check for typos in your <strong>php.ini</strong> file and have a look at the list of deprecated timezones at <a href="http://php.net/manual/en/timezones.others.php">http://php.net/manual/en/timezones.others.php</a>.'
446455
);
@@ -617,12 +626,6 @@ function_exists('mb_strlen'),
617626
'Install and enable the <strong>mbstring</strong> extension.'
618627
);
619628

620-
$this->addRecommendation(
621-
function_exists('iconv'),
622-
'iconv() should be available',
623-
'Install and enable the <strong>iconv</strong> extension.'
624-
);
625-
626629
$this->addRecommendation(
627630
function_exists('utf8_decode'),
628631
'utf8_decode() should be available',
@@ -677,6 +680,21 @@ function_exists('posix_isatty'),
677680
'Upgrade your <strong>intl</strong> extension with a newer ICU version (4+).'
678681
);
679682

683+
if (class_exists('Symfony\Component\Intl\Intl')) {
684+
$this->addRecommendation(
685+
\Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion(),
686+
sprintf('intl ICU version installed on your system is outdated (%s) and does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()),
687+
'To get the latest internationalization data upgrade the ICU system package and the intl PHP extension.'
688+
);
689+
if (\Symfony\Component\Intl\Intl::getIcuDataVersion() <= \Symfony\Component\Intl\Intl::getIcuVersion()) {
690+
$this->addRecommendation(
691+
\Symfony\Component\Intl\Intl::getIcuDataVersion() === \Symfony\Component\Intl\Intl::getIcuVersion(),
692+
sprintf('intl ICU version installed on your system (%s) does not match the ICU data bundled with Symfony (%s)', \Symfony\Component\Intl\Intl::getIcuVersion(), \Symfony\Component\Intl\Intl::getIcuDataVersion()),
693+
'To avoid internationalization data inconsistencies upgrade the symfony/intl component.'
694+
);
695+
}
696+
}
697+
680698
$this->addPhpIniRecommendation(
681699
'intl.error_level',
682700
create_function('$cfgValue', 'return (int) $cfgValue === 0;'),
@@ -706,11 +724,11 @@ function_exists('posix_isatty'),
706724
'Install and/or enable a <strong>PHP accelerator</strong> (highly recommended).'
707725
);
708726

709-
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
727+
if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
710728
$this->addRecommendation(
711-
$this->getRealpathCacheSize() > 1000,
712-
'realpath_cache_size should be above 1024 in php.ini',
713-
'Set "<strong>realpath_cache_size</strong>" to e.g. "<strong>1024</strong>" in php.ini<a href="#phpini">*</a> to improve performance on windows.'
729+
$this->getRealpathCacheSize() >= 5 * 1024 * 1024,
730+
'realpath_cache_size should be at least 5M in php.ini',
731+
'Setting "<strong>realpath_cache_size</strong>" to e.g. "<strong>5242880</strong>" or "<strong>5M</strong>" in php.ini<a href="#phpini">*</a> may improve performance on Windows significantly in some cases.'
714732
);
715733
}
716734

@@ -749,7 +767,11 @@ protected function getRealpathCacheSize()
749767
{
750768
$size = ini_get('realpath_cache_size');
751769
$size = trim($size);
752-
$unit = strtolower(substr($size, -1, 1));
770+
$unit = '';
771+
if (!ctype_digit($size)) {
772+
$unit = strtolower(substr($size, -1, 1));
773+
$size = (int) substr($size, 0, -1);
774+
}
753775
switch ($unit) {
754776
case 'g':
755777
return $size * 1024 * 1024 * 1024;
@@ -761,4 +783,28 @@ protected function getRealpathCacheSize()
761783
return (int) $size;
762784
}
763785
}
786+
787+
/**
788+
* Defines PHP required version from Symfony version.
789+
*
790+
* @return string|false The PHP required version or false if it could not be guessed
791+
*/
792+
protected function getPhpRequiredVersion()
793+
{
794+
if (!file_exists($path = __DIR__.'/../composer.lock')) {
795+
return false;
796+
}
797+
798+
$composerLock = json_decode(file_get_contents($path), true);
799+
foreach ($composerLock['packages'] as $package) {
800+
$name = $package['name'];
801+
if ('symfony/symfony' !== $name && 'symfony/http-kernel' !== $name) {
802+
continue;
803+
}
804+
805+
return (int) $package['version'][1] > 2 ? self::REQUIRED_PHP_VERSION : self::LEGACY_REQUIRED_PHP_VERSION;
806+
}
807+
808+
return false;
809+
}
764810
}

app/check.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
if ($iniPath) {
1313
echo_style('green', ' '.$iniPath);
1414
} else {
15-
echo_style('warning', ' WARNING: No configuration file (php.ini) used by PHP!');
15+
echo_style('yellow', ' WARNING: No configuration file (php.ini) used by PHP!');
1616
}
1717

1818
echo PHP_EOL.PHP_EOL;
@@ -21,7 +21,6 @@
2121

2222
$messages = array();
2323
foreach ($symfonyRequirements->getRequirements() as $req) {
24-
/** @var $req Requirement */
2524
if ($helpText = get_error_message($req, $lineSize)) {
2625
echo_style('red', 'E');
2726
$messages['error'][] = $helpText;
@@ -120,10 +119,14 @@ function echo_block($style, $title, $message)
120119

121120
echo PHP_EOL.PHP_EOL;
122121

123-
echo_style($style, str_repeat(' ', $width).PHP_EOL);
124-
echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT).PHP_EOL);
125-
echo_style($style, str_pad($message, $width, ' ', STR_PAD_RIGHT).PHP_EOL);
126-
echo_style($style, str_repeat(' ', $width).PHP_EOL);
122+
echo_style($style, str_repeat(' ', $width));
123+
echo PHP_EOL;
124+
echo_style($style, str_pad(' ['.$title.']', $width, ' ', STR_PAD_RIGHT));
125+
echo PHP_EOL;
126+
echo_style($style, $message);
127+
echo PHP_EOL;
128+
echo_style($style, str_repeat(' ', $width));
129+
echo PHP_EOL;
127130
}
128131

129132
function has_color_support()

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"incenteev/composer-parameter-handler": "^2.1",
1919
"knplabs/knp-menu": "^2.1",
2020
"knplabs/knp-menu-bundle": "^2.1",
21-
"symfony/finder": "2.3.*",
21+
"symfony/finder": "2.8.*",
2222
"kriswallsmith/assetic": "^1.3",
2323
"symfony/assetic-bundle": "dev-master",
2424
"twig/twig": "^1.24",

0 commit comments

Comments
 (0)