Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[6.x] Fix bug caused by localisation refactoring (#29967)
* 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. * Fixed code style
- Loading branch information