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 547b9b8

Browse filesBrowse files
Merge branch '4.4'
* 4.4: [HttpKernel] fixed class having a leading \ in a route controller [HttpKernel] trim the leading backslash in the controller init Bump minimal requirements Use PHPUnit 8.3 on Travis when possible
2 parents 64e96e0 + 24858f2 commit 547b9b8
Copy full SHA for 547b9b8

File tree

6 files changed

+36
-7
lines changed
Filter options

6 files changed

+36
-7
lines changed

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ matrix:
2929
env: deps=high
3030
- php: 7.3
3131
env: deps=low
32-
- php: 7.4snapshot
33-
allow_failures:
34-
- php: 7.4snapshot
3532
fast_finish: true
3633

3734
cache:

‎composer.json

Copy file name to clipboardExpand all lines: composer.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
"psr/http-client": "^1.0",
115115
"psr/simple-cache": "^1.0",
116116
"egulias/email-validator": "~1.2,>=1.2.8|~2.0",
117-
"symfony/phpunit-bridge": "^3.4.19|^4.1.8|~5.0",
117+
"symfony/phpunit-bridge": "^3.4.31|^4.3.4|~5.0",
118118
"symfony/security-acl": "~2.8|~3.0",
119119
"phpdocumentor/reflection-docblock": "^3.0|^4.0"
120120
},

‎phpunit

Copy file name to clipboardExpand all lines: phpunit
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ if (!file_exists(__DIR__.'/vendor/symfony/phpunit-bridge/bin/simple-phpunit')) {
88
exit(1);
99
}
1010
if (!getenv('SYMFONY_PHPUNIT_VERSION')) {
11-
if (\PHP_VERSION_ID >= 70400) {
12-
putenv('SYMFONY_PHPUNIT_VERSION=8.2');
11+
if (\PHP_VERSION_ID >= 70200) {
12+
putenv('SYMFONY_PHPUNIT_VERSION=8.3');
1313
} elseif (\PHP_VERSION_ID >= 70000) {
1414
putenv('SYMFONY_PHPUNIT_VERSION=6.5');
1515
}

‎src/Symfony/Bundle/FrameworkBundle/Tests/Routing/LegacyRouteLoaderContainerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Routing/LegacyRouteLoaderContainerTest.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class LegacyRouteLoaderContainerTest extends TestCase
3939
/**
4040
* {@inheritdoc}
4141
*/
42-
protected function setUp()
42+
protected function setUp(): void
4343
{
4444
$this->container = new Container();
4545
$this->container->set('foo', new \stdClass());

‎src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Controller/ContainerControllerResolver.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ protected function createController(string $controller)
4747
*/
4848
protected function instantiateController(string $class)
4949
{
50+
$class = ltrim($class, '\\');
51+
5052
if ($this->container->has($class)) {
5153
return $this->container->get($class);
5254
}

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/Controller/ContainerControllerResolverTest.php
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,36 @@ public function testGetControllerInvokableServiceWithClassNameAsName()
119119
$this->assertSame($service, $controller);
120120
}
121121

122+
/**
123+
* @dataProvider getControllers
124+
*/
125+
public function testInstantiateControllerWhenControllerStartsWithABackslash($controller)
126+
{
127+
$service = new ControllerTestService('foo');
128+
$class = ControllerTestService::class;
129+
130+
$container = $this->createMockContainer();
131+
$container->expects($this->once())->method('has')->with($class)->willReturn(true);
132+
$container->expects($this->once())->method('get')->with($class)->willReturn($service);
133+
134+
$resolver = $this->createControllerResolver(null, $container);
135+
$request = Request::create('/');
136+
$request->attributes->set('_controller', $controller);
137+
138+
$controller = $resolver->getController($request);
139+
140+
$this->assertInstanceOf(ControllerTestService::class, $controller[0]);
141+
$this->assertSame('action', $controller[1]);
142+
}
143+
144+
public function getControllers()
145+
{
146+
return [
147+
['\\'.ControllerTestService::class.'::action'],
148+
['\\'.ControllerTestService::class.':action'],
149+
];
150+
}
151+
122152
public function testExceptionWhenUsingRemovedControllerServiceWithClassNameAsName()
123153
{
124154
$this->expectException('InvalidArgumentException');

0 commit comments

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