Skip to content

Commit 9ddb421

Browse files
committed
Merge branch '2.6' into 2.7
* 2.6: (30 commits) [Translation] fixed JSON loader on PHP 7 when file is empty Fix typo Check instance of FormBuilderInterface instead of FormBuilder [Security] TokenBasedRememberMeServices test to show why encoding username is required [Security] AbstractRememberMeServices::encodeCookie() validates cookie parts fixed typo [console][formater] allow format toString object. [HttpFoundation] Fix baseUrl when script filename is contained in pathInfo Avoid redirection to XHR URIs [HttpFoundation] IpUtils::checkIp4() should allow networks [2.6] Fix HTML escaping of to-source links Fix HTML escaping of to-source links ExceptionHandler: More Encoding Fix the rendering of deprecation log messages [FrameworkBundle] Removed unnecessary parameter in TemplateController [DomCrawler] Throw an exception if a form field path is incomplete. Fixed the indentation in the compiled template for the DumpNode [Console] Delete duplicate test in CommandTest [TwigBundle] Refresh twig paths when resources change. WebProfiler break words ... Conflicts: src/Symfony/Bridge/Twig/composer.json src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig src/Symfony/Component/Debug/ExceptionHandler.php
2 parents a66ee5d + d030b3d commit 9ddb421

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Loader/JsonFileLoader.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,13 @@ public function load($resource, $locale, $domain = 'messages')
3535
throw new NotFoundResourceException(sprintf('File "%s" not found.', $resource));
3636
}
3737

38-
$messages = json_decode(file_get_contents($resource), true);
38+
$messages = array();
39+
if ($data = file_get_contents($resource)) {
40+
$messages = json_decode($data, true);
3941

40-
if (0 < $errorCode = json_last_error()) {
41-
throw new InvalidResourceException(sprintf('Error parsing JSON - %s', $this->getJSONErrorMessage($errorCode)));
42+
if (0 < $errorCode = json_last_error()) {
43+
throw new InvalidResourceException(sprintf('Error parsing JSON - %s', $this->getJSONErrorMessage($errorCode)));
44+
}
4245
}
4346

4447
if (null === $messages) {

0 commit comments

Comments
 (0)