Skip to content

Commit d9c9e0c

Browse files
Merge branch '3.4' into 4.1
* 3.4: (21 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 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 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 bumped Symfony version to 3.4.18 updated VERSION for 3.4.17 updated CHANGELOG for 3.4.17 ...
2 parents 5ee954c + 68e54f0 commit d9c9e0c

File tree

31 files changed

+606
-104
lines changed

31 files changed

+606
-104
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

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/Configuration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Symfony\Component\Lock\Lock;
2323
use Symfony\Component\Lock\Store\SemaphoreStore;
2424
use Symfony\Component\Messenger\MessageBusInterface;
25+
use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
2526
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
2627
use Symfony\Component\Serializer\Serializer;
2728
use Symfony\Component\Translation\Translator;
@@ -833,7 +834,7 @@ private function addPropertyInfoSection(ArrayNodeDefinition $rootNode)
833834
->children()
834835
->arrayNode('property_info')
835836
->info('Property info configuration')
836-
->canBeEnabled()
837+
->{!class_exists(FullStack::class) && interface_exists(PropertyInfoExtractorInterface::class) ? 'canBeDisabled' : 'canBeEnabled'}()
837838
->end()
838839
->end()
839840
;

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/FrameworkBundle/Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ protected static function getBundleDefaultConfig()
218218
'throw_exception_on_invalid_index' => false,
219219
),
220220
'property_info' => array(
221-
'enabled' => false,
221+
'enabled' => !class_exists(FullStack::class),
222222
),
223223
'router' => array(
224224
'enabled' => false,

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,12 +1155,6 @@ public function testSerializerServiceIsNotRegisteredWhenDisabled()
11551155
$this->assertFalse($container->hasDefinition('serializer'));
11561156
}
11571157

1158-
public function testPropertyInfoDisabled()
1159-
{
1160-
$container = $this->createContainerFromFile('default_config');
1161-
$this->assertFalse($container->has('property_info'));
1162-
}
1163-
11641158
public function testPropertyInfoEnabled()
11651159
{
11661160
$container = $this->createContainerFromFile('property_info');

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ public function getConfigTreeBuilder()
5858
return false;
5959
})
6060
->then(function ($v) {
61-
$v['access_decision_manager'] = array(
62-
'strategy' => AccessDecisionManager::STRATEGY_AFFIRMATIVE,
63-
);
61+
$v['access_decision_manager']['strategy'] = AccessDecisionManager::STRATEGY_AFFIRMATIVE;
6462

6563
return $v;
6664
})

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

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

439439
/**
440440
* @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
441-
* @expectedExceptionMessage "strategy" and "service" cannot be used together.
441+
* @expectedExceptionMessage Invalid configuration for path "security.access_decision_manager": "strategy" and "service" cannot be used together.
442442
*/
443443
public function testAccessDecisionManagerServiceAndStrategyCannotBeUsedAtTheSameTime()
444444
{
445-
$container = $this->getContainer('access_decision_manager_service_and_strategy');
445+
$this->getContainer('access_decision_manager_service_and_strategy');
446+
}
447+
448+
public function testAccessDecisionManagerOptionsAreNotOverriddenByImplicitStrategy()
449+
{
450+
$container = $this->getContainer('access_decision_manager_customized_config');
451+
452+
$accessDecisionManagerDefinition = $container->getDefinition('security.access.decision_manager');
453+
454+
$this->assertSame(AccessDecisionManager::STRATEGY_AFFIRMATIVE, $accessDecisionManagerDefinition->getArgument(1));
455+
$this->assertTrue($accessDecisionManagerDefinition->getArgument(2));
456+
$this->assertFalse($accessDecisionManagerDefinition->getArgument(3));
446457
}
447458

448459
/**
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
@@ -489,10 +489,6 @@ private function isTrivialInstance(Definition $definition): bool
489489
}
490490
}
491491

492-
if (false !== strpos($this->dumpLiteralClass($this->dumpValue($definition->getClass())), '$')) {
493-
return false;
494-
}
495-
496492
return true;
497493
}
498494

@@ -559,18 +555,16 @@ private function addService(string $id, Definition $definition, string &$file =
559555
$return = array();
560556

561557
if ($class = $definition->getClass()) {
562-
$class = $this->container->resolveEnvPlaceholders($class);
558+
$class = $class instanceof Parameter ? '%'.$class.'%' : $this->container->resolveEnvPlaceholders($class);
563559
$return[] = sprintf(0 === strpos($class, '%') ? '@return object A %1$s instance' : '@return \%s', ltrim($class, '\\'));
564560
} elseif ($definition->getFactory()) {
565561
$factory = $definition->getFactory();
566562
if (\is_string($factory)) {
567563
$return[] = sprintf('@return object An instance returned by %s()', $factory);
568564
} elseif (\is_array($factory) && (\is_string($factory[0]) || $factory[0] instanceof Definition || $factory[0] instanceof Reference)) {
569-
if (\is_string($factory[0]) || $factory[0] instanceof Reference) {
570-
$return[] = sprintf('@return object An instance returned by %s::%s()', (string) $factory[0], $factory[1]);
571-
} elseif ($factory[0] instanceof Definition) {
572-
$return[] = sprintf('@return object An instance returned by %s::%s()', $factory[0]->getClass(), $factory[1]);
573-
}
565+
$class = $factory[0] instanceof Definition ? $factory[0]->getClass() : (string) $factory[0];
566+
$class = $class instanceof Parameter ? '%'.$class.'%' : $this->container->resolveEnvPlaceholders($class);
567+
$return[] = sprintf('@return object An instance returned by %s::%s()', $class, $factory[1]);
574568
}
575569
}
576570

@@ -671,7 +665,7 @@ private function addInlineVariables(string &$head, string &$tail, string $id, ar
671665
if (\is_array($argument)) {
672666
$hasSelfRef = $this->addInlineVariables($head, $tail, $id, $argument, $forConstructor) || $hasSelfRef;
673667
} elseif ($argument instanceof Reference) {
674-
$hasSelfRef = $this->addInlineReference($head, $tail, $id, $argument, $forConstructor) || $hasSelfRef;
668+
$hasSelfRef = $this->addInlineReference($head, $id, $argument, $forConstructor) || $hasSelfRef;
675669
} elseif ($argument instanceof Definition) {
676670
$hasSelfRef = $this->addInlineService($head, $tail, $id, $argument, $forConstructor) || $hasSelfRef;
677671
}
@@ -680,37 +674,31 @@ private function addInlineVariables(string &$head, string &$tail, string $id, ar
680674
return $hasSelfRef;
681675
}
682676

683-
private function addInlineReference(string &$head, string &$tail, string $id, string $targetId, bool $forConstructor): bool
677+
private function addInlineReference(string &$code, string $id, string $targetId, bool $forConstructor): bool
684678
{
679+
$hasSelfRef = isset($this->circularReferences[$id][$targetId]);
680+
685681
if ('service_container' === $targetId || isset($this->referenceVariables[$targetId])) {
686-
return isset($this->circularReferences[$id][$targetId]);
682+
return $hasSelfRef;
687683
}
688684

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

691-
if (2 > $callCount && (!$forConstructor || !isset($this->circularReferences[$id][$targetId]))) {
692-
return isset($this->circularReferences[$id][$targetId]);
687+
if (2 > $callCount && (!$hasSelfRef || !$forConstructor)) {
688+
return $hasSelfRef;
693689
}
694690

695691
$name = $this->getNextVariableName();
696692
$this->referenceVariables[$targetId] = new Variable($name);
697693

698694
$reference = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $behavior ? new Reference($targetId, $behavior) : null;
699-
$code = sprintf(" \$%s = %s;\n", $name, $this->getServiceCall($targetId, $reference));
700-
701-
if (!isset($this->circularReferences[$id][$targetId])) {
702-
$head .= $code;
695+
$code .= sprintf(" \$%s = %s;\n", $name, $this->getServiceCall($targetId, $reference));
703696

704-
return false;
697+
if (!$hasSelfRef || !$forConstructor) {
698+
return $hasSelfRef;
705699
}
706700

707-
if (!$forConstructor) {
708-
$tail .= $code;
709-
710-
return true;
711-
}
712-
713-
$head .= $code.sprintf(<<<'EOTXT'
701+
$code .= sprintf(<<<'EOTXT'
714702
715703
if (isset($this->%s['%s'])) {
716704
return $this->%1$s['%2$s'];
@@ -733,17 +721,21 @@ private function addInlineService(string &$head, string &$tail, string $id, Defi
733721

734722
$arguments = array($definition->getArguments(), $definition->getFactory());
735723

736-
if (2 > $this->inlinedDefinitions[$definition] && !$definition->getMethodCalls() && !$definition->getProperties() && !$definition->getConfigurator() && false === strpos($this->dumpValue($definition->getClass()), '$')) {
724+
if (2 > $this->inlinedDefinitions[$definition] && !$definition->getMethodCalls() && !$definition->getProperties() && !$definition->getConfigurator()) {
737725
return $this->addInlineVariables($head, $tail, $id, $arguments, $forConstructor);
738726
}
739727

740728
$name = $this->getNextVariableName();
741729
$this->definitionVariables[$definition] = new Variable($name);
742730

743731
$code = '';
744-
$hasSelfRef = $this->addInlineVariables($code, $tail, $id, $arguments, $forConstructor);
732+
if ($forConstructor) {
733+
$hasSelfRef = $this->addInlineVariables($code, $tail, $id, $arguments, $forConstructor);
734+
} else {
735+
$hasSelfRef = $this->addInlineVariables($code, $code, $id, $arguments, $forConstructor);
736+
}
745737
$code .= $this->addNewInstance($definition, '$'.$name, ' = ', $id);
746-
$hasSelfRef ? $tail .= ('' !== $tail ? "\n" : '').$code : $head .= ('' !== $head ? "\n" : '').$code;
738+
$hasSelfRef && !$forConstructor ? $tail .= ('' !== $tail ? "\n" : '').$code : $head .= ('' !== $head ? "\n" : '').$code;
747739

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

0 commit comments

Comments
 (0)