Skip to content

framework.translator.default_path  #37111

@SimonHeimberg

Description

@SimonHeimberg

Symfony version(s) affected: 3.4.??, 4.4.9 (appears somewhen in symfony 3.4)

Description

In symfony 3.4, the value of framework.translator.default_path could be set to null to only use the paths from framework.translator.paths.

When it is set to null in symfony 4.4, there is a fatal error when calling bin/console. A failure message would be fine, but not a fatal error.

(About order of translation files: symfony/symfony-docs#13430)

How to reproduce

Create a symfony project in version 4.4 (or take an existing one)

$ composer require symfony/translation

adapt config/packages/translations.yaml, set framework.translator.default_path: 0 like this:

framework:
    translator:
        default_path: null # default value is '%kernel.project_dir%/translations'

now run

$ bin/console --help
PHP Fatal error: ...

Possible Solution
one of

  • allow null in Symfony\Component\DependencyInjection\ContainerBuilder::fileExists(), or
  • report clearly the config value may not be null

Additional context

stack trace of fatal failure

$ bin/console cache:clear --no-warmup # or bin/console --help
PHP Fatal error:  Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: Argument 1 passed to Symfony\Component\DependencyInjection\ContainerBuilder::fileExists() must be of the type string, null given, called in .../myProy/vendor/symfony/framework-bundle/DependencyInjection/FrameworkExtension.php on line 1217 in .../myProy/vendor/symfony/dependency-injection/ContainerBuilder.php:388
Stack trace:
#0 .../myProy/vendor/symfony/framework-bundle/DependencyInjection/FrameworkExtension.php(1217): Symfony\Component\DependencyInjection\ContainerBuilder->fileExists(NULL)
#1 .../myProy/vendor/symfony/framework-bundle/DependencyInjection/FrameworkExtension.php(344): Symfony\Bundle\FrameworkBundle\DependencyInjection\FrameworkExtension->registerTranslatorConfiguration(Array, Object(Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationContainerBuilder), Object(Symfony\Component\DependencyInjection\Loader\XmlFileLoader), 'env_ee51596b420...')
#2 .../myProy/ in .../myProy/vendor/symfony/dependency-injection/ContainerBuilder.php on line 388

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions