[Routing] fix route loading with wildcard, but dir or file is empty
This commit is contained in:
parent
537d373e0d
commit
217058b475
@ -39,7 +39,8 @@ class RoutingConfigurator
|
|||||||
final public function import($resource, $type = null, $ignoreErrors = false)
|
final public function import($resource, $type = null, $ignoreErrors = false)
|
||||||
{
|
{
|
||||||
$this->loader->setCurrentDir(\dirname($this->path));
|
$this->loader->setCurrentDir(\dirname($this->path));
|
||||||
$imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file);
|
$imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file) ?? [];
|
||||||
|
|
||||||
if (!\is_array($imported)) {
|
if (!\is_array($imported)) {
|
||||||
return new ImportConfigurator($this->collection, $imported);
|
return new ImportConfigurator($this->collection, $imported);
|
||||||
}
|
}
|
||||||
|
@ -169,7 +169,7 @@ class XmlFileLoader extends FileLoader
|
|||||||
$this->setCurrentDir(\dirname($path));
|
$this->setCurrentDir(\dirname($path));
|
||||||
|
|
||||||
/** @var RouteCollection[] $imported */
|
/** @var RouteCollection[] $imported */
|
||||||
$imported = $this->import($resource, ('' !== $type ? $type : null), false, $file);
|
$imported = $this->import($resource, ('' !== $type ? $type : null), false, $file) ?? [];
|
||||||
|
|
||||||
if (!\is_array($imported)) {
|
if (!\is_array($imported)) {
|
||||||
$imported = [$imported];
|
$imported = [$imported];
|
||||||
|
@ -187,7 +187,7 @@ class YamlFileLoader extends FileLoader
|
|||||||
|
|
||||||
$this->setCurrentDir(\dirname($path));
|
$this->setCurrentDir(\dirname($path));
|
||||||
|
|
||||||
$imported = $this->import($config['resource'], $type, false, $file);
|
$imported = $this->import($config['resource'], $type, false, $file) ?? [];
|
||||||
|
|
||||||
if (!\is_array($imported)) {
|
if (!\is_array($imported)) {
|
||||||
$imported = [$imported];
|
$imported = [$imported];
|
||||||
|
0
src/Symfony/Component/Routing/Tests/Fixtures/controller/empty_wildcard/.gitignore
vendored
Normal file
0
src/Symfony/Component/Routing/Tests/Fixtures/controller/empty_wildcard/.gitignore
vendored
Normal file
@ -5,3 +5,7 @@ api:
|
|||||||
resource: ../controller/routing.yml
|
resource: ../controller/routing.yml
|
||||||
name_prefix: api_
|
name_prefix: api_
|
||||||
prefix: /api
|
prefix: /api
|
||||||
|
|
||||||
|
empty_wildcard:
|
||||||
|
resource: ../controller/empty_wildcard/*
|
||||||
|
prefix: /empty_wildcard
|
||||||
|
Reference in New Issue
Block a user