Skip to content

Commit af6281f

Browse files
Merge branch '2.6' into 2.7
* 2.6: [Routing][DependencyInjection] Support .yaml extension in YAML loaders [DX] improve file loader error for router/other resources in bundle [FrameworkBundle] Initialize translator with the default locale. [FrameworkBundle] Fix Routing\DelegatingLoader resiliency to fatal errors [2.6][Translation] remove duplicate code for loading catalogue. [HttpKernel] Cleanup ExceptionListener CS fixes [DependencyInjection] Show better error when the Yaml component is not installed [2.3] SCA for Components - reference mismatches [Debug] Scream as LogLevel::DEBUG (but for fatal errors / uncaught exceptions) [2.3] Static Code Analysis for Components [WebProfilerBundle] Fix resiliency to exceptions thrown by the url generator [Translation] LoggingTranslator simplifications [Translation][fixed test] refresh cache when resources are no longer fresh. [FrameworkBundle] Fixed server:start --router relative path issue #14124 [FrameworkBundle] improve usage of Table helper [Validator] Added missing Simplified Chinese (zh_CN) translations [FrameworkBundle] Workaround php -S ignoring auto_prepend_file Conflicts: src/Symfony/Bundle/FrameworkBundle/Tests/Translation/TranslatorTest.php src/Symfony/Component/Console/Helper/Table.php src/Symfony/Component/Translation/LoggingTranslator.php
2 parents d2dc62b + aed15e1 commit af6281f

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

Exception/FileLoaderLoadException.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ public function __construct($resource, $sourceResource = null, $code = null, $pr
5858
if ('@' === $resource[0]) {
5959
$parts = explode(DIRECTORY_SEPARATOR, $resource);
6060
$bundle = substr($parts[0], 1);
61-
$message .= ' '.sprintf('Make sure the "%s" bundle is correctly registered and loaded in the application kernel class.', $bundle);
61+
$message .= sprintf(' Make sure the "%s" bundle is correctly registered and loaded in the application kernel class.', $bundle);
62+
$message .= sprintf(' If the bundle is registered, make sure the bundle path "%s" is not empty.', $resource);
6263
}
6364

6465
parent::__construct($message, $code, $previous);

Loader/FileLoader.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,12 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe
103103
}
104104
self::$loading[$resource] = true;
105105

106-
$ret = $loader->load($resource, $type);
106+
try {
107+
$ret = $loader->load($resource, $type);
108+
} catch (\Exception $e) {
109+
unset(self::$loading[$resource]);
110+
throw $e;
111+
}
107112

108113
unset(self::$loading[$resource]);
109114

Tests/Exception/FileLoaderLoadExceptionTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public function testMessageCannotImportBundleResource()
3232
$exception = new FileLoaderLoadException('@resource', 'sourceResource');
3333
$this->assertEquals(
3434
'Cannot import resource "@resource" from "sourceResource". '.
35-
'Make sure the "resource" bundle is correctly registered and loaded in the application kernel class.',
35+
'Make sure the "resource" bundle is correctly registered and loaded in the application kernel class. '.
36+
'If the bundle is registered, make sure the bundle path "@resource" is not empty.',
3637
$exception->getMessage()
3738
);
3839
}
@@ -76,7 +77,8 @@ public function testMessageHasPreviousErrorAndUnableToLoadBundle()
7677
$this->assertEquals(
7778
'There was a previous error with an ending dot in @resource '.
7879
'(which is loaded in resource "@resource"). '.
79-
'Make sure the "resource" bundle is correctly registered and loaded in the application kernel class.',
80+
'Make sure the "resource" bundle is correctly registered and loaded in the application kernel class. '.
81+
'If the bundle is registered, make sure the bundle path "@resource" is not empty.',
8082
$exception->getMessage()
8183
);
8284
}

0 commit comments

Comments
 (0)