Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Fix BC break in TranslatorServiceFactory #5979

wants to merge 1 commit into from

3 participants

Martin-P Roel van Duijnhoven Marco Pivetta

Fix for issue #5978. The check for the intl extension must be done after checking for the translator config key, not before. The test for this was deactivated, this PR also reactivates that test again.

Roel van Duijnhoven

This would also solve issues that I am having. In my configuration the ocale is explicitly set, thus no need to fall back to DummyTranslator.


Did a rebase on my branch, because the CS-fixer was broken and made Travis fail. All is well now :)

Marco Pivetta Ocramius added this to the 2.3.1 milestone
Marco Pivetta Ocramius self-assigned this
Marco Pivetta Ocramius referenced this pull request from a commit
Marco Pivetta Ocramius Merge branch 'hotfix/#5979-#5978-translator-service-factory-without-i…
…ntl' into develop

Close #5979 #5978
Forward Port #5979 #5978
Marco Pivetta Ocramius closed this in 2ac901c
Martin-P Martin-P deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
10 library/Zend/Mvc/Service/TranslatorServiceFactory.php
@@ -34,11 +34,6 @@ public function createService(ServiceLocatorInterface $serviceLocator)
return new MvcTranslator($serviceLocator->get('Zend\I18n\Translator\TranslatorInterface'));
- // If ext/intl is not loaded, return a dummy translator
- if (!extension_loaded('intl')) {
- return new MvcTranslator(new DummyTranslator());
- }
// Load a translator from configuration, if possible
if ($serviceLocator->has('Config')) {
$config = $serviceLocator->get('Config');
@@ -59,6 +54,11 @@ public function createService(ServiceLocatorInterface $serviceLocator)
+ // If ext/intl is not loaded, return a dummy translator
+ if (!extension_loaded('intl')) {
+ return new MvcTranslator(new DummyTranslator());
+ }
// For BC purposes (pre-2.3.0), use the I18n Translator
return new MvcTranslator(new Translator());
4 tests/ZendTest/Mvc/Service/TranslatorServiceFactoryTest.php
@@ -55,10 +55,6 @@ public function testReturnsMvcTranslatorWithI18nTranslatorComposedWhenNoTranslat
public function testReturnsTranslatorBasedOnConfigurationWhenNoTranslatorInterfaceServicePresent()
- if (!extension_loaded('intl')) {
- $this->markTestSkipped('This test will only run if ext/intl is present');
- }
$config = array('translator' => array(
'locale' => 'en_US',
Something went wrong with that request. Please try again.