Skip to content

allow null for framework.translator.default_path #40744

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 26, 2021

Conversation

SimonHeimberg
Copy link
Contributor

@SimonHeimberg SimonHeimberg commented Apr 8, 2021

Allow to configure framework.translator.default_path to null, as it was until symfony 3.4.x (fix BC compatibility).

Q A
Branch? 4.4 for bug fixes
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #37111
License MIT
Doc PR no

@ro0NL
Copy link
Contributor

ro0NL commented Apr 8, 2021

shouldnt we fix it at the Configuration level, given ->defaultValue('%kernel.project_dir%/translations')

IIUC cannotBeEmpty is missing.

@SimonHeimberg
Copy link
Contributor Author

shouldnt we fix it at the Configuration level, given ->defaultValue('%kernel.project_dir%/translations')

IIUC cannotBeEmpty is missing.

I see two options:

  • allow null again, as it was before 3.4.x (not sure about the exact version)
  • prevent null cleanly (Your suggestion is probably cleaner. Failing with a fatal php error as currently is bad.)

I am not sure which way to go. Actually it was a BC break in 3.4.x, which was not noticed quickly. For more details see #37111

@ro0NL
Copy link
Contributor

ro0NL commented Apr 8, 2021

i think it broke as of 4.x due the added type hint in ContainerBuilder::fileExists

before the inexistence was implicit, eg. if ($container->fileExists($dir = $defaultDir.'/'.$name)) { checks /$name at root level if $defaultDir is null.

So i think allowing explicit null in config is reasonable and should be handled as such, everywhere. As it preserves BC with 3.4

@SimonHeimberg
Copy link
Contributor Author

SimonHeimberg commented Apr 9, 2021

Should I add a test case checking this config value? Where should I add it? I doubt that src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php would test enough places 🤔

Allow to configure framework.translator.default_path to null, as it was until symfony 3.4.x (fix BC compatibility).

fixes symfony#37111
@SimonHeimberg SimonHeimberg changed the title clear failure on warmup when translator.default_path is null allow null for framework.translator.default_path Apr 9, 2021
@fabpot
Copy link
Member

fabpot commented Aug 26, 2021

Thank you @SimonHeimberg.

@fabpot fabpot merged commit dd42aec into symfony:4.4 Aug 26, 2021
This was referenced Aug 30, 2021
@SimonHeimberg SimonHeimberg deleted the patch-3 branch October 13, 2021 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants