Skip to content

Commit

Permalink
bug #24304 [FrameworkBundle] Fix Routing\DelegatingLoader (nicolas-gr…
Browse files Browse the repository at this point in the history
…ekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[FrameworkBundle] Fix Routing\DelegatingLoader

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Spotted while reviewing: the default controller is not always a string, so parsing should only be done conditionally.

Commits
-------

a69c1b2 [FrameworkBundle] Fix Routing\DelegatingLoader
  • Loading branch information
nicolas-grekas committed Sep 25, 2017
2 parents a40c94d + a69c1b2 commit 4129fd2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function load($resource, $type = null)
$this->loading = false;

foreach ($collection->all() as $route) {
if (!$controller = $route->getDefault('_controller')) {
if (!is_string($controller = $route->getDefault('_controller')) || !$controller) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,7 @@ fragment_home:
fragment_inlined:
path: /fragment_inlined
defaults: { _controller: TestBundle:Fragment:inlined }

array_controller:
path: /array_controller
defaults: { _controller: [ArrayController, someAction] }

0 comments on commit 4129fd2

Please sign in to comment.