[HttpKernel] Fix "Locale class not found" in ConfigDataCollector

This commit is contained in:
Nicolas Grekas 2016-12-18 19:57:23 +01:00
parent 0ab6628431
commit 8f5e917557
2 changed files with 2 additions and 2 deletions

View File

@ -68,7 +68,7 @@ class ConfigDataCollector extends DataCollector
'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a',
'php_version' => PHP_VERSION,
'php_architecture' => PHP_INT_SIZE * 8,
'php_intl_locale' => \Locale::getDefault() ?: 'n/a',
'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
'php_timezone' => date_default_timezone_get(),
'xdebug_enabled' => extension_loaded('xdebug'),
'apcu_enabled' => extension_loaded('apcu') && ini_get('apc.enabled'),

View File

@ -32,7 +32,7 @@ class ConfigDataCollectorTest extends \PHPUnit_Framework_TestCase
$this->assertSame('testkernel', $c->getAppName());
$this->assertSame(PHP_VERSION, $c->getPhpVersion());
$this->assertSame(PHP_INT_SIZE * 8, $c->getPhpArchitecture());
$this->assertSame(\Locale::getDefault() ?: 'n/a', $c->getPhpIntlLocale());
$this->assertSame(class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', $c->getPhpIntlLocale());
$this->assertSame(date_default_timezone_get(), $c->getPhpTimezone());
$this->assertSame(Kernel::VERSION, $c->getSymfonyVersion());
$this->assertNull($c->getToken());