Skip to content

Commit 8848a1a

Browse files
Merge branch '4.1'
* 4.1: (27 commits) Added the Code of Conduct file do not override custom access decision configs [Security] Do not deauthenticate user when the first refreshed user has changed fix a return type hint invalidate stale commits for PRs too add missing cache prefix seed attribute to XSD fix command description Fix class documentation [Validator] Add a missing translation [FrameworkBundle] Fix 3.4 tests [DI] fix dumping inline services again Rename consumer to receiver Register messenger before the profiler Fix phpdocs [EventDispatcher] Remove template method in test case Added LB translation for symfony#27993 (UUID validator message translation) Replace deprecated validateValue with validate [FWBundle] Automatically enable PropertyInfo when using Flex [Process] fix locking of pipe files on Windows Correct PHPDoc type for float ttl ...
2 parents 9a37ba4 + d9c9e0c commit 8848a1a

File tree

33 files changed

+613
-107
lines changed

33 files changed

+613
-107
lines changed

.github/rm-invalid-lowest-lock-files.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ function getContentHash(array $composerJson)
104104
}
105105
}
106106

107-
if (!$referencedCommits || (isset($_SERVER['TRAVIS_PULL_REQUEST']) && 'false' !== $_SERVER['TRAVIS_PULL_REQUEST'])) {
108-
// cached commits cannot be stale for PRs
107+
if (!$referencedCommits) {
109108
return;
110109
}
111110

CHANGELOG-4.1.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ in 4.1 minor versions.
77
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
88
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v4.1.0...v4.1.1
99

10+
* 4.1.6 (2018-10-03)
11+
12+
* bug #28604 [Finder] fixed root directory access for ftp/sftp wrapper (DerDu)
13+
* bug #28688 [FWBundle] Throw if PropertyInfo is enabled, but the component isn't installed (dunglas)
14+
* bug #28638 [Console] Fix clearing sections containing questions (chalasr)
15+
* bug #28690 [FrameworkBundle] dont suggest hidden services in debug:container and debug:autow commands (nicolas-grekas)
16+
* bug #28648 [PHPUnitBridge] Fix ClockMock microtime() format (acasademont)
17+
* bug #28678 [DI] fix dumping setters before their inlined instances (nicolas-grekas)
18+
* bug #28672 [DI] fix error in dumped container (nicolas-grekas)
19+
* bug #28664 [Console] Don't return early as this bypasses the auto exit feature (duncan3dc)
20+
1021
* 4.1.5 (2018-09-30)
1122

1223
* bug #28636 [HttpFoundation] X-Accel-Mapping does not use HTTP key=value syntax (c960657)

CODE_OF_CONDUCT.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
Code of Conduct
2+
===============
3+
4+
Our Pledge
5+
----------
6+
7+
In the interest of fostering an open and welcoming environment, we as
8+
contributors and maintainers pledge to making participation in our project and
9+
our community a harassment-free experience for everyone, regardless of age, body
10+
size, disability, ethnic origin, gender identity and expression, level of
11+
experience, education, socio-economic status, nationality, personal appearance,
12+
religion, or sexual identity and orientation.
13+
14+
Our Standards
15+
-------------
16+
17+
Examples of behavior that contributes to creating a positive environment
18+
include:
19+
20+
* Using welcoming and inclusive language
21+
* Being respectful of differing viewpoints and experiences
22+
* Gracefully accepting constructive criticism
23+
* Focusing on what is best for the community
24+
* Showing empathy towards other community members
25+
26+
Examples of unacceptable behavior by participants include:
27+
28+
* The use of sexualized language or imagery and unwelcome sexual attention or
29+
advances
30+
* Trolling, insulting/derogatory comments, and personal or political attacks
31+
* Public or private harassment
32+
* Publishing others' private information, such as a physical or electronic
33+
address, without explicit permission
34+
* Other conduct which could reasonably be considered inappropriate in a
35+
professional setting
36+
37+
Our Responsibilities
38+
--------------------
39+
40+
[CoC Active Response Ensurers, or CARE][1], are responsible for clarifying the
41+
standards of acceptable behavior and are expected to take appropriate and fair
42+
corrective action in response to any instances of unacceptable behavior.
43+
44+
CARE team members have the right and responsibility to remove, edit, or reject
45+
comments, commits, code, wiki edits, issues, and other contributions that are
46+
not aligned to this Code of Conduct, or to ban temporarily or permanently any
47+
contributor for other behaviors that they deem inappropriate, threatening,
48+
offensive, or harmful.
49+
50+
Scope
51+
-----
52+
53+
This Code of Conduct applies both within project spaces and in public spaces
54+
when an individual is representing the project or its community. Examples of
55+
representing a project or community include using an official project e-mail
56+
address, posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event. Representation of a project may be
58+
further defined and clarified by CARE team members.
59+
60+
Enforcement
61+
-----------
62+
63+
Instances of abusive, harassing, or otherwise unacceptable behavior
64+
[may be reported][2] by contacting the [CARE team members][1].
65+
All complaints will be reviewed and investigated and will result in a response
66+
that is deemed necessary and appropriate to the circumstances. The CARE team is
67+
obligated to maintain confidentiality with regard to the reporter of an
68+
incident. Further details of specific enforcement policies may be posted
69+
separately.
70+
71+
CARE team members who do not follow or enforce the Code of Conduct in good
72+
faith may face temporary or permanent repercussions as determined by the
73+
[core team][3].
74+
75+
Attribution
76+
-----------
77+
78+
This Code of Conduct is adapted from the [Contributor Covenant version 1.4][4].
79+
80+
[1]: https://symfony.com/doc/current/contributing/code_of_conduct/care_team.html
81+
[2]: https://symfony.com/doc/current/contributing/code_of_conduct/reporting_guidelines.html
82+
[3]: https://symfony.com/doc/current/contributing/code/core_team.html
83+
[4]: https://www.contributor-covenant.org/version/1/4/code-of-conduct.html

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,13 @@ public function load(array $configs, ContainerBuilder $container)
253253
$this->registerTemplatingConfiguration($config['templating'], $container, $loader);
254254
}
255255

256+
if ($this->messengerConfigEnabled = $this->isConfigEnabled($container, $config['messenger'])) {
257+
$this->registerMessengerConfiguration($config['messenger'], $container, $loader, $config['serializer'], $config['validation']);
258+
} else {
259+
$container->removeDefinition('console.command.messenger_consume_messages');
260+
$container->removeDefinition('console.command.messenger_debug');
261+
}
262+
256263
$this->registerValidationConfiguration($config['validation'], $container, $loader);
257264
$this->registerEsiConfiguration($config['esi'], $container, $loader);
258265
$this->registerSsiConfiguration($config['ssi'], $container, $loader);
@@ -282,13 +289,6 @@ public function load(array $configs, ContainerBuilder $container)
282289
$this->registerLockConfiguration($config['lock'], $container, $loader);
283290
}
284291

285-
if ($this->messengerConfigEnabled = $this->isConfigEnabled($container, $config['messenger'])) {
286-
$this->registerMessengerConfiguration($config['messenger'], $container, $loader, $config['serializer'], $config['validation']);
287-
} else {
288-
$container->removeDefinition('console.command.messenger_consume_messages');
289-
$container->removeDefinition('console.command.messenger_debug');
290-
}
291-
292292
if ($this->isConfigEnabled($container, $config['web_link'])) {
293293
if (!class_exists(HttpHeaderSerializer::class)) {
294294
throw new LogicException('WebLink support cannot be enabled as the WebLink component is not installed.');

src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,8 @@
260260
<xsd:element name="default-memcached-provider" type="xsd:string" minOccurs="0" maxOccurs="1" />
261261
<xsd:element name="pool" type="cache_pool" minOccurs="0" maxOccurs="unbounded" />
262262
</xsd:sequence>
263+
264+
<xsd:attribute name="prefix-seed" type="xsd:string" />
263265
</xsd:complexType>
264266

265267
<xsd:complexType name="cache_pool">

src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@ public function getConfigTreeBuilder()
6060
return false;
6161
})
6262
->then(function ($v) {
63-
$v['access_decision_manager'] = array(
64-
'strategy' => AccessDecisionManager::STRATEGY_AFFIRMATIVE,
65-
);
63+
$v['access_decision_manager']['strategy'] = AccessDecisionManager::STRATEGY_AFFIRMATIVE;
6664

6765
return $v;
6866
})

src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,22 @@ public function testCustomAccessDecisionManagerService()
414414

415415
/**
416416
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
417-
* @expectedExceptionMessage "strategy" and "service" cannot be used together.
417+
* @expectedExceptionMessage Invalid configuration for path "security.access_decision_manager": "strategy" and "service" cannot be used together.
418418
*/
419419
public function testAccessDecisionManagerServiceAndStrategyCannotBeUsedAtTheSameTime()
420420
{
421-
$container = $this->getContainer('access_decision_manager_service_and_strategy');
421+
$this->getContainer('access_decision_manager_service_and_strategy');
422+
}
423+
424+
public function testAccessDecisionManagerOptionsAreNotOverriddenByImplicitStrategy()
425+
{
426+
$container = $this->getContainer('access_decision_manager_customized_config');
427+
428+
$accessDecisionManagerDefinition = $container->getDefinition('security.access.decision_manager');
429+
430+
$this->assertSame(AccessDecisionManager::STRATEGY_AFFIRMATIVE, $accessDecisionManagerDefinition->getArgument(1));
431+
$this->assertTrue($accessDecisionManagerDefinition->getArgument(2));
432+
$this->assertFalse($accessDecisionManagerDefinition->getArgument(3));
422433
}
423434

424435
/**
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
$container->loadFromExtension('security', array(
4+
'access_decision_manager' => array(
5+
'allow_if_all_abstain' => true,
6+
'allow_if_equal_granted_denied' => false,
7+
),
8+
'providers' => array(
9+
'default' => array(
10+
'memory' => array(
11+
'users' => array(
12+
'foo' => array('password' => 'foo', 'roles' => 'ROLE_USER'),
13+
),
14+
),
15+
),
16+
),
17+
'firewalls' => array(
18+
'simple' => array('pattern' => '/login', 'security' => false),
19+
),
20+
));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<srv:container xmlns="http://symfony.com/schema/dic/security"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:srv="http://symfony.com/schema/dic/services"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
6+
7+
<config>
8+
<access-decision-manager allow-if-all-abstain="true" allow-if-equal-granted-denied="false" />
9+
10+
<provider name="default">
11+
<memory>
12+
<user name="foo" password="foo" roles="ROLE_USER" />
13+
</memory>
14+
</provider>
15+
16+
<firewall name="simple" pattern="/login" security="false" />
17+
</config>
18+
</srv:container>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
security:
2+
access_decision_manager:
3+
allow_if_all_abstain: true
4+
allow_if_equal_granted_denied: false
5+
providers:
6+
default:
7+
memory:
8+
users:
9+
foo: { password: foo, roles: ROLE_USER }
10+
firewalls:
11+
simple: { pattern: /login, security: false }

src/Symfony/Bundle/WebServerBundle/Command/ServerStatusCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected function configure()
4040
new InputOption('pidfile', null, InputOption::VALUE_REQUIRED, 'PID file'),
4141
new InputOption('filter', null, InputOption::VALUE_REQUIRED, 'The value to display (one of port, host, or address)'),
4242
))
43-
->setDescription('Outputs the status of the local web server for the given address')
43+
->setDescription('Outputs the status of the local web server')
4444
->setHelp(<<<'EOF'
4545
<info>%command.name%</info> shows the details of the given local web
4646
server, such as the address and port where it is listening to:

src/Symfony/Component/Console/Command/Command.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,12 @@ public function getNativeDefinition()
361361
/**
362362
* Adds an argument.
363363
*
364-
* @param string $name The argument name
365-
* @param int $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL
366-
* @param string $description A description text
367-
* @param mixed $default The default value (for InputArgument::OPTIONAL mode only)
364+
* @param string $name The argument name
365+
* @param int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL
366+
* @param string $description A description text
367+
* @param string|string[]|null $default The default value (for self::OPTIONAL mode only)
368+
*
369+
* @throws InvalidArgumentException When argument mode is not valid
368370
*
369371
* @return $this
370372
*/
@@ -378,11 +380,13 @@ public function addArgument($name, $mode = null, $description = '', $default = n
378380
/**
379381
* Adds an option.
380382
*
381-
* @param string $name The option name
382-
* @param string $shortcut The shortcut (can be null)
383-
* @param int $mode The option mode: One of the InputOption::VALUE_* constants
384-
* @param string $description A description text
385-
* @param mixed $default The default value (must be null for InputOption::VALUE_NONE)
383+
* @param string $name The option name
384+
* @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts
385+
* @param int|null $mode The option mode: One of the VALUE_* constants
386+
* @param string $description A description text
387+
* @param string|string[]|bool|null $default The default value (must be null for self::VALUE_NONE)
388+
*
389+
* @throws InvalidArgumentException If option mode is invalid or incompatible
386390
*
387391
* @return $this
388392
*/

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -519,10 +519,6 @@ private function isTrivialInstance(Definition $definition): bool
519519
}
520520
}
521521

522-
if (false !== strpos($this->dumpLiteralClass($this->dumpValue($definition->getClass())), '$')) {
523-
return false;
524-
}
525-
526522
return true;
527523
}
528524

@@ -589,18 +585,16 @@ private function addService(string $id, Definition $definition): array
589585
$return = array();
590586

591587
if ($class = $definition->getClass()) {
592-
$class = $this->container->resolveEnvPlaceholders($class);
588+
$class = $class instanceof Parameter ? '%'.$class.'%' : $this->container->resolveEnvPlaceholders($class);
593589
$return[] = sprintf(0 === strpos($class, '%') ? '@return object A %1$s instance' : '@return \%s', ltrim($class, '\\'));
594590
} elseif ($definition->getFactory()) {
595591
$factory = $definition->getFactory();
596592
if (\is_string($factory)) {
597593
$return[] = sprintf('@return object An instance returned by %s()', $factory);
598594
} elseif (\is_array($factory) && (\is_string($factory[0]) || $factory[0] instanceof Definition || $factory[0] instanceof Reference)) {
599-
if (\is_string($factory[0]) || $factory[0] instanceof Reference) {
600-
$return[] = sprintf('@return object An instance returned by %s::%s()', (string) $factory[0], $factory[1]);
601-
} elseif ($factory[0] instanceof Definition) {
602-
$return[] = sprintf('@return object An instance returned by %s::%s()', $factory[0]->getClass(), $factory[1]);
603-
}
595+
$class = $factory[0] instanceof Definition ? $factory[0]->getClass() : (string) $factory[0];
596+
$class = $class instanceof Parameter ? '%'.$class.'%' : $this->container->resolveEnvPlaceholders($class);
597+
$return[] = sprintf('@return object An instance returned by %s::%s()', $class, $factory[1]);
604598
}
605599
}
606600

@@ -696,7 +690,7 @@ private function addInlineVariables(string &$head, string &$tail, string $id, ar
696690
if (\is_array($argument)) {
697691
$hasSelfRef = $this->addInlineVariables($head, $tail, $id, $argument, $forConstructor) || $hasSelfRef;
698692
} elseif ($argument instanceof Reference) {
699-
$hasSelfRef = $this->addInlineReference($head, $tail, $id, $argument, $forConstructor) || $hasSelfRef;
693+
$hasSelfRef = $this->addInlineReference($head, $id, $argument, $forConstructor) || $hasSelfRef;
700694
} elseif ($argument instanceof Definition) {
701695
$hasSelfRef = $this->addInlineService($head, $tail, $id, $argument, $forConstructor) || $hasSelfRef;
702696
}
@@ -705,37 +699,31 @@ private function addInlineVariables(string &$head, string &$tail, string $id, ar
705699
return $hasSelfRef;
706700
}
707701

708-
private function addInlineReference(string &$head, string &$tail, string $id, string $targetId, bool $forConstructor): bool
702+
private function addInlineReference(string &$code, string $id, string $targetId, bool $forConstructor): bool
709703
{
704+
$hasSelfRef = isset($this->circularReferences[$id][$targetId]);
705+
710706
if ('service_container' === $targetId || isset($this->referenceVariables[$targetId])) {
711-
return isset($this->circularReferences[$id][$targetId]);
707+
return $hasSelfRef;
712708
}
713709

714710
list($callCount, $behavior) = $this->serviceCalls[$targetId];
715711

716-
if (2 > $callCount && (!$forConstructor || !isset($this->circularReferences[$id][$targetId]))) {
717-
return isset($this->circularReferences[$id][$targetId]);
712+
if (2 > $callCount && (!$hasSelfRef || !$forConstructor)) {
713+
return $hasSelfRef;
718714
}
719715

720716
$name = $this->getNextVariableName();
721717
$this->referenceVariables[$targetId] = new Variable($name);
722718

723719
$reference = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $behavior ? new Reference($targetId, $behavior) : null;
724-
$code = sprintf(" \$%s = %s;\n", $name, $this->getServiceCall($targetId, $reference));
725-
726-
if (!isset($this->circularReferences[$id][$targetId])) {
727-
$head .= $code;
720+
$code .= sprintf(" \$%s = %s;\n", $name, $this->getServiceCall($targetId, $reference));
728721

729-
return false;
722+
if (!$hasSelfRef || !$forConstructor) {
723+
return $hasSelfRef;
730724
}
731725

732-
if (!$forConstructor) {
733-
$tail .= $code;
734-
735-
return true;
736-
}
737-
738-
$head .= $code.sprintf(<<<'EOTXT'
726+
$code .= sprintf(<<<'EOTXT'
739727
740728
if (isset($this->%s['%s'])) {
741729
return $this->%1$s['%2$s'];
@@ -758,17 +746,21 @@ private function addInlineService(string &$head, string &$tail, string $id, Defi
758746

759747
$arguments = array($definition->getArguments(), $definition->getFactory());
760748

761-
if (2 > $this->inlinedDefinitions[$definition] && !$definition->getMethodCalls() && !$definition->getProperties() && !$definition->getConfigurator() && false === strpos($this->dumpValue($definition->getClass()), '$')) {
749+
if (2 > $this->inlinedDefinitions[$definition] && !$definition->getMethodCalls() && !$definition->getProperties() && !$definition->getConfigurator()) {
762750
return $this->addInlineVariables($head, $tail, $id, $arguments, $forConstructor);
763751
}
764752

765753
$name = $this->getNextVariableName();
766754
$this->definitionVariables[$definition] = new Variable($name);
767755

768756
$code = '';
769-
$hasSelfRef = $this->addInlineVariables($code, $tail, $id, $arguments, $forConstructor);
757+
if ($forConstructor) {
758+
$hasSelfRef = $this->addInlineVariables($code, $tail, $id, $arguments, $forConstructor);
759+
} else {
760+
$hasSelfRef = $this->addInlineVariables($code, $code, $id, $arguments, $forConstructor);
761+
}
770762
$code .= $this->addNewInstance($definition, ' $'.$name.' = ', $id);
771-
$hasSelfRef ? $tail .= ('' !== $tail ? "\n" : '').$code : $head .= ('' !== $head ? "\n" : '').$code;
763+
$hasSelfRef && !$forConstructor ? $tail .= ('' !== $tail ? "\n" : '').$code : $head .= ('' !== $head ? "\n" : '').$code;
772764

773765
$code = '';
774766
$arguments = array($definition->getProperties(), $definition->getMethodCalls(), $definition->getConfigurator());

0 commit comments

Comments
 (0)