Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f9b9774

Browse filesBrowse files
authored
[FrameworkBundle] Improve performance of ControllerNameParser
1 parent 620ea20 commit f9b9774
Copy full SHA for f9b9774

File tree

1 file changed

+6
-1
lines changed
Filter options

1 file changed

+6
-1
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Controller/ControllerNameParser.php
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@ public function __construct(KernelInterface $kernel)
4747
public function parse($controller)
4848
{
4949
$originalController = $controller;
50-
if (3 !== count($parts = explode(':', $controller))) {
50+
$parts = explode(':', $controller);
51+
52+
// The second condition is for cases when this method is called with the
53+
// class::method string instead of a:b:c. It's important to fail early in this
54+
// case because calling findAlternative needlessly is bad for performance.
55+
if (3 !== count($parts) || $parts[1] === '') {
5156
throw new \InvalidArgumentException(sprintf('The "%s" controller is not a valid "a:b:c" controller string.', $controller));
5257
}
5358

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.