Skip to content
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

[6.x] Fix bug caused by localisation refactoring #29967

Merged
merged 2 commits into from
Sep 12, 2019

Commits on Sep 12, 2019

  1. Fix bug caused by localisation refactoring

    In Laravel 5.8 calling __(null) would return null. Due to the code refactoring __(null) now returns a Translator object. As this is not mentioned in the Upgrade Guide I presume this is an unintended bug. This pull request resolves the issue.
    
    Details:
    In Laravel 5.8 you could run the following code in a blade:
        @Dump(trans(null))  // Returns Translator object in 5.8 and 6.
        @Dump(__(null))  // Returns null in 5.8 and Translator object in 6.
    
        {{ __(null) }} // Runs successfully on 5.8 fails on 6.0 see error below.
    
    Facade\Ignition\Exceptions\ViewException
    htmlspecialchars() expects parameter 1 to be string, object given (View: resources\views\welcome.blade.php)
    
    If it is intentional the upgrade guide should be updated to put an if statement checking for null for each translatable variable that could contain null.
    marijnkampf authored Sep 12, 2019
    Configuration menu
    Copy the full SHA
    ff598fd View commit details
    Browse the repository at this point in the history
  2. Fixed code style

    marijnkampf authored Sep 12, 2019
    Configuration menu
    Copy the full SHA
    f332535 View commit details
    Browse the repository at this point in the history