Skip to content

Commit d25ecdc

Browse files
bug symfony#20981 [HttpKernel] Fix "Locale class not found" in ConfigDataCollector (nicolas-grekas)
This PR was merged into the 3.3-dev branch. Discussion ---------- [HttpKernel] Fix "Locale class not found" in ConfigDataCollector | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - PHP 7.0 & 7.1, no intl, "Locale" is not defined. Commits ------- 8f5e917 [HttpKernel] Fix "Locale class not found" in ConfigDataCollector
2 parents 0ab6628 + 8f5e917 commit d25ecdc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function collect(Request $request, Response $response, \Exception $except
6868
'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a',
6969
'php_version' => PHP_VERSION,
7070
'php_architecture' => PHP_INT_SIZE * 8,
71-
'php_intl_locale' => \Locale::getDefault() ?: 'n/a',
71+
'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
7272
'php_timezone' => date_default_timezone_get(),
7373
'xdebug_enabled' => extension_loaded('xdebug'),
7474
'apcu_enabled' => extension_loaded('apcu') && ini_get('apc.enabled'),

src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function testCollect()
3232
$this->assertSame('testkernel', $c->getAppName());
3333
$this->assertSame(PHP_VERSION, $c->getPhpVersion());
3434
$this->assertSame(PHP_INT_SIZE * 8, $c->getPhpArchitecture());
35-
$this->assertSame(\Locale::getDefault() ?: 'n/a', $c->getPhpIntlLocale());
35+
$this->assertSame(class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', $c->getPhpIntlLocale());
3636
$this->assertSame(date_default_timezone_get(), $c->getPhpTimezone());
3737
$this->assertSame(Kernel::VERSION, $c->getSymfonyVersion());
3838
$this->assertNull($c->getToken());

0 commit comments

Comments
 (0)