Skip to content

Commit 8bbd738

Browse files
Merge branch '4.0' into 4.1
* 4.0: [HttpKernel] Fix restoring trusted proxies in tests Update UPGRADE-4.0.md CODEOWNERS: some more rules removed unneeded comments in tests removed unneeded comments in tests Change PHPDoc in ResponseHeaderBag::getCookies() to help IDEs [HttpKernel] fix registering IDE links [HttpKernel] Set first trusted proxy as REMOTE_ADDR in InlineFragmentRenderer. [Process] Consider \"executable\" suffixes first on Windows Triggering RememberMe's loginFail() when token cannot be created [Serializer] Fix serializer tries to denormalize null values on nullable properties [FrameworkBundle] Change priority of AddConsoleCommandPass to TYPE_BEFORE_REMOVING
2 parents 3d3d5c4 + b2e93cf commit 8bbd738

File tree

25 files changed

+280
-86
lines changed

25 files changed

+280
-86
lines changed

.github/CODEOWNERS

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
1+
# Console
2+
/src/Symfony/Component/Console/Logger/ConsoleLogger.php @dunglas
3+
# DependencyInjection
4+
/src/Symfony/Component/DependencyInjection/Compiler/AutowirePass.php @dunglas
5+
# HttpKernel
6+
/src/Symfony/Component/HttpKernel/Log/Logger.php @dunglas
17
# LDAP
28
/src/Symfony/Component/Ldap/* @csarrazi
39
# Lock
410
/src/Symfony/Component/Lock/* @jderusse
511
# Messenger
612
/src/Symfony/Bridge/Doctrine/Messenger/* @sroze
713
/src/Symfony/Component/Messenger/* @sroze
14+
# PropertyInfo
15+
/src/Symfony/Component/PropertyInfo/* @dunglas
16+
/src/Symfony/Bridge/Doctrine/PropertyInfo/* @dunglas
17+
# Serializer
18+
/src/Symfony/Component/Serializer/* @dunglas
19+
# WebLink
20+
/src/Symfony/Component/WebLink/* @dunglas
821
# Workflow
922
/src/Symfony/Bridge/Twig/Extension/WorkflowExtension.php @lyrixx
1023
/src/Symfony/Bridge/Twig/Tests/Extension/WorkflowExtensionTest.php @lyrixx

UPGRADE-4.0.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,9 @@ Security
759759
* The `GuardAuthenticatorInterface` interface has been removed.
760760
Use `AuthenticatorInterface` instead.
761761

762+
* When extending `AbstractGuardAuthenticator` getCredentials() cannot return
763+
`null` anymore, return false from `supports()` if no credentials available instead.
764+
762765
SecurityBundle
763766
--------------
764767

UPGRADE-4.1.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ Form
6464
}
6565
```
6666

67-
* Added `help` option to the form field. If you have custom Form extension for it, you should remove it.
68-
Also remove it from the custom form theme.
67+
* Added `help` option to the form field. If you have custom Form extension for it, you should remove it.
68+
Also remove it from the custom form theme.
6969

7070
FrameworkBundle
7171
---------------

src/Symfony/Bridge/Monolog/Tests/Processor/WebProcessorTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public function testUseRequestClientIp()
4949
$this->assertEquals($server['REQUEST_METHOD'], $record['extra']['http_method']);
5050
$this->assertEquals($server['SERVER_NAME'], $record['extra']['server']);
5151
$this->assertEquals($server['HTTP_REFERER'], $record['extra']['referrer']);
52+
53+
Request::setTrustedProxies(array(), -1);
5254
}
5355

5456
public function testCanBeConstructedWithExtraFields()

src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ class FrameworkBundle extends Bundle
6464
{
6565
public function boot()
6666
{
67-
if (!ini_get('xdebug.file_link_format') && !get_cfg_var('xdebug.file_link_format')) {
68-
ini_set('xdebug.file_link_format', $this->container->getParameter('debug.file_link_format'));
69-
}
7067
ErrorHandler::register(null, false)->throwAt($this->container->getParameter('debug.error_handler.throw_at'), true);
7168

7269
if ($this->container->getParameter('kernel.http_method_override')) {
@@ -102,7 +99,7 @@ public function build(ContainerBuilder $container)
10299
$this->addCompilerPassIfExists($container, AddConstraintValidatorsPass::class, PassConfig::TYPE_BEFORE_REMOVING);
103100
$container->addCompilerPass(new AddAnnotationsCachedReaderPass(), PassConfig::TYPE_AFTER_REMOVING, -255);
104101
$this->addCompilerPassIfExists($container, AddValidatorInitializersPass::class);
105-
$this->addCompilerPassIfExists($container, AddConsoleCommandPass::class);
102+
$this->addCompilerPassIfExists($container, AddConsoleCommandPass::class, PassConfig::TYPE_BEFORE_REMOVING);
106103
$this->addCompilerPassIfExists($container, TranslatorPass::class);
107104
$container->addCompilerPass(new LoggingTranslatorPass());
108105
$container->addCompilerPass(new AddExpressionLanguageProvidersPass());

src/Symfony/Bundle/FrameworkBundle/Resources/config/web.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
<argument type="service" id="logger" on-invalid="null" />
7575
<argument>%kernel.debug%</argument>
7676
<argument>%kernel.charset%</argument>
77+
<argument>%debug.file_link_format%</argument>
7778
</service>
7879

7980
<service id="validate_request_listener" class="Symfony\Component\HttpKernel\EventListener\ValidateRequestListener">

src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class ExceptionController
3030
protected $twig;
3131
protected $debug;
3232
protected $profiler;
33+
private $fileLinkFormat;
3334

3435
public function __construct(Profiler $profiler = null, Environment $twig, bool $debug, FileLinkFormatter $fileLinkFormat = null)
3536
{

src/Symfony/Component/Console/Tests/DependencyInjection/AddConsoleCommandPassTest.php

Lines changed: 79 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
namespace Symfony\Component\Console\Tests\DependencyInjection;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\Console\Command\Command;
1516
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
1617
use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass;
17-
use Symfony\Component\Console\Command\Command;
1818
use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument;
19+
use Symfony\Component\DependencyInjection\ChildDefinition;
20+
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
1921
use Symfony\Component\DependencyInjection\ContainerBuilder;
2022
use Symfony\Component\DependencyInjection\Definition;
2123
use Symfony\Component\DependencyInjection\TypedReference;
@@ -28,7 +30,7 @@ class AddConsoleCommandPassTest extends TestCase
2830
public function testProcess($public)
2931
{
3032
$container = new ContainerBuilder();
31-
$container->addCompilerPass(new AddConsoleCommandPass());
33+
$container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING);
3234
$container->setParameter('my-command.class', 'Symfony\Component\Console\Tests\DependencyInjection\MyCommand');
3335

3436
$id = 'my-command';
@@ -124,7 +126,7 @@ public function testProcessThrowAnExceptionIfTheServiceIsAbstract()
124126
{
125127
$container = new ContainerBuilder();
126128
$container->setResourceTracking(false);
127-
$container->addCompilerPass(new AddConsoleCommandPass());
129+
$container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING);
128130

129131
$definition = new Definition('Symfony\Component\Console\Tests\DependencyInjection\MyCommand');
130132
$definition->addTag('console.command');
@@ -142,7 +144,7 @@ public function testProcessThrowAnExceptionIfTheServiceIsNotASubclassOfCommand()
142144
{
143145
$container = new ContainerBuilder();
144146
$container->setResourceTracking(false);
145-
$container->addCompilerPass(new AddConsoleCommandPass());
147+
$container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING);
146148

147149
$definition = new Definition('SplObjectStorage');
148150
$definition->addTag('console.command');
@@ -171,6 +173,79 @@ public function testProcessPrivateServicesWithSameCommand()
171173
$this->assertTrue($container->hasAlias($aliasPrefix.'my-command1'));
172174
$this->assertTrue($container->hasAlias($aliasPrefix.'my-command2'));
173175
}
176+
177+
public function testProcessOnChildDefinitionWithClass()
178+
{
179+
$container = new ContainerBuilder();
180+
$container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING);
181+
$className = 'Symfony\Component\Console\Tests\DependencyInjection\MyCommand';
182+
183+
$parentId = 'my-parent-command';
184+
$childId = 'my-child-command';
185+
186+
$parentDefinition = new Definition(/* no class */);
187+
$parentDefinition->setAbstract(true)->setPublic(false);
188+
189+
$childDefinition = new ChildDefinition($parentId);
190+
$childDefinition->addTag('console.command')->setPublic(true);
191+
$childDefinition->setClass($className);
192+
193+
$container->setDefinition($parentId, $parentDefinition);
194+
$container->setDefinition($childId, $childDefinition);
195+
196+
$container->compile();
197+
$command = $container->get($childId);
198+
199+
$this->assertInstanceOf($className, $command);
200+
}
201+
202+
public function testProcessOnChildDefinitionWithParentClass()
203+
{
204+
$container = new ContainerBuilder();
205+
$container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING);
206+
$className = 'Symfony\Component\Console\Tests\DependencyInjection\MyCommand';
207+
208+
$parentId = 'my-parent-command';
209+
$childId = 'my-child-command';
210+
211+
$parentDefinition = new Definition($className);
212+
$parentDefinition->setAbstract(true)->setPublic(false);
213+
214+
$childDefinition = new ChildDefinition($parentId);
215+
$childDefinition->addTag('console.command')->setPublic(true);
216+
217+
$container->setDefinition($parentId, $parentDefinition);
218+
$container->setDefinition($childId, $childDefinition);
219+
220+
$container->compile();
221+
$command = $container->get($childId);
222+
223+
$this->assertInstanceOf($className, $command);
224+
}
225+
226+
/**
227+
* @expectedException \RuntimeException
228+
* @expectedExceptionMessage The definition for "my-child-command" has no class.
229+
*/
230+
public function testProcessOnChildDefinitionWithoutClass()
231+
{
232+
$container = new ContainerBuilder();
233+
$container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING);
234+
235+
$parentId = 'my-parent-command';
236+
$childId = 'my-child-command';
237+
238+
$parentDefinition = new Definition();
239+
$parentDefinition->setAbstract(true)->setPublic(false);
240+
241+
$childDefinition = new ChildDefinition($parentId);
242+
$childDefinition->addTag('console.command')->setPublic(true);
243+
244+
$container->setDefinition($parentId, $parentDefinition);
245+
$container->setDefinition($childId, $childDefinition);
246+
247+
$container->compile();
248+
}
174249
}
175250

176251
class MyCommand extends Command

src/Symfony/Component/HttpFoundation/ResponseHeaderBag.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public function removeCookie($name, $path = '/', $domain = null)
210210
*
211211
* @param string $format
212212
*
213-
* @return array
213+
* @return Cookie[]
214214
*
215215
* @throws \InvalidArgumentException When the $format is invalid
216216
*/

src/Symfony/Component/HttpFoundation/Tests/RequestTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ class RequestTest extends TestCase
2121
{
2222
protected function tearDown()
2323
{
24-
// reset
2524
Request::setTrustedProxies(array(), -1);
2625
Request::setTrustedHosts(array());
2726
}

0 commit comments

Comments
 (0)