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 68d5e0d

Browse filesBrowse files
committed
bug #20756 [3.1][HttpKernel] Regression test for missing controller arguments (iltar)
This PR was merged into the 3.1 branch. Discussion ---------- [3.1][HttpKernel] Regression test for missing controller arguments | Q | A | ------------- | --- | Branch? | 3.1 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #20746 | License | MIT | Doc PR | ~ Same fix as #20755 but for 3.1 and up as the new feature was hit by the same bug. ping @fabpot Commits ------- 9e588b8 Regression test for missing controller arguments (3.1)
2 parents b699e4b + 9e588b8 commit 68d5e0d
Copy full SHA for 68d5e0d

File tree

Expand file treeCollapse file tree

2 files changed

+12
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-1
lines changed

‎src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DefaultValueResolver.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ final class DefaultValueResolver implements ArgumentValueResolverInterface
2727
*/
2828
public function supports(Request $request, ArgumentMetadata $argument)
2929
{
30-
return $argument->hasDefaultValue() || ($argument->isNullable() && !$argument->isVariadic());
30+
return $argument->hasDefaultValue() || (null !== $argument->getType() && $argument->isNullable() && !$argument->isVariadic());
3131
}
3232

3333
/**

‎src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolverTest.php
+11Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,17 @@ public function testGetArgumentWithoutArray()
203203
$resolver->getArguments($request, $controller);
204204
}
205205

206+
/**
207+
* @expectedException \RuntimeException
208+
*/
209+
public function testIfExceptionIsThrownWhenMissingAnArgument()
210+
{
211+
$request = Request::create('/');
212+
$controller = array($this, 'controllerWithFoo');
213+
214+
self::$resolver->getArguments($request, $controller);
215+
}
216+
206217
/**
207218
* @requires PHP 7.1
208219
*/

0 commit comments

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