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 aad2242

Browse filesBrowse files
Merge branch '5.4' into lock-table-creation
* 5.4: (32 commits) Remove duplicated entry in UPGRADE-6.0.md Fix KernelBrowser::loginUser() causing deprecation Handle alias in completion script use $sessionId instead of $sessionCookiePath on SessionUtils::popSessionCookie call Fix TranslationTrait for multiple domains Fix parameter types for ProcessHelper::mustRun() Fix: Wording [SecurityBundle] Fix ambiguous deprecation message on missing provider Remove dead code in tests [Translation][Loco] Make http requests synchronous when reading the Loco API Remove return void PHPDoc in test Fix merge Fix compatibility with symfony/security-core 6.x Don't rely on deprecated strategy constants Use external links instead of fake issue templates Fix description that does not work well Document deprecations in Security Tokens Add missing files from 5.3 Remove unneeded files Tweak bug report template ...
2 parents e16b64a + 060d328 commit aad2242
Copy full SHA for aad2242

File tree

47 files changed

+436
-255
lines changed
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner

47 files changed

+436
-255
lines changed

‎.github/ISSUE_TEMPLATE/1_Bug_report.md

Copy file name to clipboardExpand all lines: .github/ISSUE_TEMPLATE/1_Bug_report.md
-22Lines changed: 0 additions & 22 deletions
This file was deleted.

‎.github/ISSUE_TEMPLATE/1_Bug_report.yaml

Copy file name to clipboardExpand all lines: .github/ISSUE_TEMPLATE/1_Bug_report.yaml
+11-5Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 🐛 Bug Report
2-
description: ⚠️ See below for security reports
2+
description: ⚠️ NEVER report security issues, read https://symfony.com/security instead
33
labels: Bug
44

55
body:
@@ -14,23 +14,29 @@ body:
1414
id: description
1515
attributes:
1616
label: Description
17-
description: A clear and consise description of the problem
17+
description: A clear and concise description of the problem
1818
validations:
1919
required: true
2020
- type: textarea
2121
id: how-to-reproduce
2222
attributes:
2323
label: How to reproduce
2424
description: |
25-
Code and/or config needed to reproduce the problem.
26-
If it's a complex bug, create a "bug reproducer" as explained in https://symfony.com/doc/current/contributing/code/reproducer.html
25+
⚠️ This is the most important part of the report ⚠️
26+
Without a way to easily reproduce your issue, there is little chance we will be able to help you and work on a fix.
27+
Please, take the time to show us some code and/or config that is needed for others to reproduce the problem easily.
28+
Most of the time, creating a "bug reproducer" as explained in the URL below is the best way to help us
29+
and increases the chances someone will have a look at it:
30+
https://symfony.com/doc/current/contributing/code/reproducer.html
2731
validations:
2832
required: true
2933
- type: textarea
3034
id: possible-solution
3135
attributes:
3236
label: Possible Solution
33-
description: "Optional: only if you have suggestions on a fix/reason for the bug"
37+
description: |
38+
Optional: only if you have suggestions on a fix/reason for the bug
39+
Don't hesitate to create a pull request with your solution, it helps get faster feedback.
3440
- type: textarea
3541
id: additional-context
3642
attributes:

‎.github/ISSUE_TEMPLATE/2_Feature_request.md

Copy file name to clipboardExpand all lines: .github/ISSUE_TEMPLATE/2_Feature_request.md
-12Lines changed: 0 additions & 12 deletions
This file was deleted.

‎.github/ISSUE_TEMPLATE/3_Support_question.md

Copy file name to clipboardExpand all lines: .github/ISSUE_TEMPLATE/3_Support_question.md
-11Lines changed: 0 additions & 11 deletions
This file was deleted.

‎.github/ISSUE_TEMPLATE/4_Documentation_issue.md

Copy file name to clipboardExpand all lines: .github/ISSUE_TEMPLATE/4_Documentation_issue.md
-10Lines changed: 0 additions & 10 deletions
This file was deleted.

‎.github/ISSUE_TEMPLATE/config.yml

Copy file name to clipboard
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: Support Question
4+
url: https://symfony.com/support
5+
about: We use GitHub issues only to discuss about Symfony bugs and new features. For this kind of questions about using Symfony or third-party bundles, please use any of the support alternatives shown in https://symfony.com/support
6+
- name: Documentation Issue
7+
url: https://github.com/symfony/symfony-docs/issues
8+
about: Symfony Documentation has its own dedicated repository.

‎.github/PULL_REQUEST_TEMPLATE.md

Copy file name to clipboard
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
| Q | A
22
| ------------- | ---
3-
| Branch? | 5.4 for features / 4.4 or 5.3 for bug fixes <!-- see below -->
3+
| Branch? | 6.1 for features / 4.4, 5.3, 5.4 or 6.0 for bug fixes <!-- see below -->
44
| Bug fix? | yes/no
55
| New feature? | yes/no <!-- please update src/**/CHANGELOG.md files -->
66
| Deprecations? | yes/no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
77
| Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
88
| License | MIT
99
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
1010
<!--
11-
Replace this notice by a short README for your feature/bugfix. This will help people
12-
understand your PR and can be used as a start for the documentation.
11+
Replace this notice by a short README for your feature/bugfix.
12+
This will help reviewers and should be a good start for the documentation.
1313
1414
Additionally (see https://symfony.com/releases):
1515
- Always add tests and ensure they pass.
16-
- Never break backward compatibility (see https://symfony.com/bc).
1716
- Bug fixes must be submitted against the lowest maintained branch where they apply
1817
(lowest branches are regularly merged to upper ones so they get the fixes too.)
1918
- Features and deprecations must be submitted against branch 5.x.
2019
- Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
20+
- Never break backward compatibility (see https://symfony.com/bc).
2121
-->

‎.github/workflows/unit-tests.yml

Copy file name to clipboardExpand all lines: .github/workflows/unit-tests.yml
+7-4Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ jobs:
2121
matrix:
2222
include:
2323
- php: '7.2'
24-
- php: '8.1'
2524
- php: '7.4'
26-
mode: high-deps
2725
- php: '8.0'
26+
mode: high-deps
27+
- php: '8.1'
2828
mode: low-deps
2929
- php: '8.2'
3030
mode: experimental
@@ -174,19 +174,21 @@ jobs:
174174
exit 0
175175
fi
176176
177-
(cd src/Symfony/Component/HttpFoundation; cp composer.json composer.bak; composer require --dev --no-update mongodb/mongodb)
178-
179177
if [[ "${{ matrix.mode }}" = low-deps ]]; then
180178
echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} 'cd {} && $COMPOSER_UP --prefer-lowest --prefer-stable && $PHPUNIT'"
181179
182180
exit 0
183181
fi
184182
183+
(cd src/Symfony/Component/HttpFoundation; cp composer.json composer.bak; composer require --dev --no-update mongodb/mongodb)
184+
(cd src/Symfony/Component/Lock; cp composer.json composer.bak; composer require --dev --no-update mongodb/mongodb)
185+
185186
# matrix.mode = high-deps
186187
echo "$COMPONENTS" | xargs -n1 | parallel -j +3 "_run_tests {} 'cd {} && $COMPOSER_UP && $PHPUNIT$LEGACY'" || X=1
187188
188189
# get a list of the patched components (relies on .github/build-packages.php being called in the previous step)
189190
(cd src/Symfony/Component/HttpFoundation; mv composer.bak composer.json)
191+
(cd src/Symfony/Component/Lock; mv composer.bak composer.json)
190192
PATCHED_COMPONENTS=$(git diff --name-only src/ | grep composer.json || true)
191193
192194
# for 5.4 LTS, checkout and test previous major with the patched components (only for patched components)
@@ -200,6 +202,7 @@ jobs:
200202
git checkout -m FETCH_HEAD
201203
PATCHED_COMPONENTS=$(echo "$PATCHED_COMPONENTS" | xargs dirname | xargs -n1 -I{} bash -c "[ -e '{}/phpunit.xml.dist' ] && echo '{}'" | sort || true)
202204
(cd src/Symfony/Component/HttpFoundation; composer require --dev --no-update mongodb/mongodb)
205+
(cd src/Symfony/Component/Lock; composer require --dev --no-update mongodb/mongodb)
203206
if [[ $PATCHED_COMPONENTS ]]; then
204207
echo "::group::install phpunit"
205208
./phpunit install

‎UPGRADE-5.4.md

Copy file name to clipboardExpand all lines: UPGRADE-5.4.md
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,19 @@ Security
170170
* Deprecate passing the strategy as string to `AccessDecisionManager`,
171171
pass an instance of `AccessDecisionStrategyInterface` instead
172172
* Flag `AccessDecisionManager` as `@final`
173+
* Deprecate passing `$credentials` to `PreAuthenticatedToken`,
174+
`SwitchUserToken` and `UsernamePasswordToken`:
175+
176+
Before:
177+
```php
178+
$token = new UsernamePasswordToken($user, $credentials, $firewallName, $roles);
179+
$token = new PreAuthenticatedToken($user, $credentials, $firewallName, $roles);
180+
$token = new SwitchUserToken($user, $credentials, $firewallName, $roles, $originalToken);
181+
```
182+
183+
After:
184+
```php
185+
$token = new UsernamePasswordToken($user, $firewallName, $roles);
186+
$token = new PreAuthenticatedToken($user, $firewallName, $roles);
187+
$token = new SwitchUserToken($user, $firewallName, $roles, $originalToken);
188+
```

‎UPGRADE-6.0.md

Copy file name to clipboardExpand all lines: UPGRADE-6.0.md
+16-1Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ HttpFoundation
124124
* Removed the `Request::HEADER_X_FORWARDED_ALL` constant, use either `Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO` or `Request::HEADER_X_FORWARDED_AWS_ELB` or `Request::HEADER_X_FORWARDED_TRAEFIK`constants instead
125125
* Rename `RequestStack::getMasterRequest()` to `getMainRequest()`
126126
* Not passing `FILTER_REQUIRE_ARRAY` or `FILTER_FORCE_ARRAY` flags to `InputBag::filter()` when filtering an array will throw `BadRequestException`
127-
* Removed the `Request::HEADER_X_FORWARDED_ALL` constant
128127
* Retrieving non-scalar values using `InputBag::get()` will throw `BadRequestException` (use `InputBad::all()` instead to retrieve an array)
129128
* Passing non-scalar default value as the second argument `InputBag::get()` will throw `\InvalidArgumentException`
130129
* Passing non-scalar, non-array value as the second argument `InputBag::set()` will throw `\InvalidArgumentException`
@@ -408,6 +407,22 @@ Security
408407
```
409408
* `AccessDecisionManager` does not accept strings as strategy anymore,
410409
pass an instance of `AccessDecisionStrategyInterface` instead
410+
* Removed the `$credentials` argument of `PreAuthenticatedToken`,
411+
`SwitchUserToken` and `UsernamePasswordToken`:
412+
413+
Before:
414+
```php
415+
$token = new UsernamePasswordToken($user, $credentials, $firewallName, $roles);
416+
$token = new PreAuthenticatedToken($user, $credentials, $firewallName, $roles);
417+
$token = new SwitchUserToken($user, $credentials, $firewallName, $roles, $originalToken);
418+
```
419+
420+
After:
421+
```php
422+
$token = new UsernamePasswordToken($user, $firewallName, $roles);
423+
$token = new PreAuthenticatedToken($user, $firewallName, $roles);
424+
$token = new SwitchUserToken($user, $firewallName, $roles, $originalToken);
425+
```
411426

412427
SecurityBundle
413428
--------------

‎src/Symfony/Bridge/Doctrine/ManagerRegistry.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/ManagerRegistry.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function (&$wrappedInstance, LazyLoadingInterface $manager) use ($name) {
5959
$name = $this->aliases[$name];
6060
}
6161
if (isset($this->fileMap[$name])) {
62-
$wrappedInstance = $this->load($this->fileMap[$name]);
62+
$wrappedInstance = $this->load($this->fileMap[$name], false);
6363
} else {
6464
$wrappedInstance = $this->{$this->methodMap[$name]}(false);
6565
}

‎src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/ManagerRegistryTest.php
+92Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@
1212
namespace Symfony\Bridge\Doctrine\Tests;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use ProxyManager\Proxy\LazyLoadingInterface;
16+
use ProxyManager\Proxy\ValueHolderInterface;
1517
use Symfony\Bridge\Doctrine\ManagerRegistry;
18+
use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper;
1619
use Symfony\Bridge\ProxyManager\Tests\LazyProxy\Dumper\PhpDumperTest;
20+
use Symfony\Component\DependencyInjection\ContainerBuilder;
21+
use Symfony\Component\DependencyInjection\ContainerInterface;
22+
use Symfony\Component\DependencyInjection\Dumper\PhpDumper;
23+
use Symfony\Component\Filesystem\Filesystem;
1724

1825
class ManagerRegistryTest extends TestCase
1926
{
@@ -39,6 +46,91 @@ public function testResetService()
3946
$this->assertSame($foo, $container->get('foo'));
4047
$this->assertObjectNotHasAttribute('bar', $foo);
4148
}
49+
50+
/**
51+
* When performing an entity manager lazy service reset, the reset operations may re-use the container
52+
* to create a "fresh" service: when doing so, it can happen that the "fresh" service is itself a proxy.
53+
*
54+
* Because of that, the proxy will be populated with a wrapped value that is itself a proxy: repeating
55+
* the reset operation keeps increasing this nesting until the application eventually runs into stack
56+
* overflow or memory overflow operations, which can happen for long-running processes that rely on
57+
* services that are reset very often.
58+
*/
59+
public function testResetServiceWillNotNestFurtherLazyServicesWithinEachOther()
60+
{
61+
// This test scenario only applies to containers composed as a set of generated sources
62+
$this->dumpLazyServiceProjectAsFilesServiceContainer();
63+
64+
/** @var ContainerInterface $container */
65+
$container = new \LazyServiceProjectAsFilesServiceContainer();
66+
67+
$registry = new TestManagerRegistry(
68+
'irrelevant',
69+
[],
70+
['defaultManager' => 'foo'],
71+
'irrelevant',
72+
'defaultManager',
73+
'irrelevant'
74+
);
75+
$registry->setTestContainer($container);
76+
77+
$service = $container->get('foo');
78+
79+
self::assertInstanceOf(\stdClass::class, $service);
80+
self::assertInstanceOf(LazyLoadingInterface::class, $service);
81+
self::assertInstanceOf(ValueHolderInterface::class, $service);
82+
self::assertFalse($service->isProxyInitialized());
83+
84+
$service->initializeProxy();
85+
86+
self::assertTrue($container->initialized('foo'));
87+
self::assertTrue($service->isProxyInitialized());
88+
89+
$registry->resetManager();
90+
$service->initializeProxy();
91+
92+
$wrappedValue = $service->getWrappedValueHolderValue();
93+
self::assertInstanceOf(\stdClass::class, $wrappedValue);
94+
self::assertNotInstanceOf(LazyLoadingInterface::class, $wrappedValue);
95+
self::assertNotInstanceOf(ValueHolderInterface::class, $wrappedValue);
96+
}
97+
98+
private function dumpLazyServiceProjectAsFilesServiceContainer()
99+
{
100+
if (class_exists(\LazyServiceProjectAsFilesServiceContainer::class, false)) {
101+
return;
102+
}
103+
104+
$container = new ContainerBuilder();
105+
106+
$container->register('foo', \stdClass::class)
107+
->setPublic(true)
108+
->setLazy(true);
109+
$container->compile();
110+
111+
$fileSystem = new Filesystem();
112+
113+
$temporaryPath = $fileSystem->tempnam(sys_get_temp_dir(), 'symfonyManagerRegistryTest');
114+
$fileSystem->remove($temporaryPath);
115+
$fileSystem->mkdir($temporaryPath);
116+
117+
$dumper = new PhpDumper($container);
118+
119+
$dumper->setProxyDumper(new ProxyDumper());
120+
$containerFiles = $dumper->dump([
121+
'class' => 'LazyServiceProjectAsFilesServiceContainer',
122+
'as_files' => true,
123+
]);
124+
125+
array_walk(
126+
$containerFiles,
127+
static function (string $containerSources, string $fileName) use ($temporaryPath): void {
128+
(new Filesystem())->dumpFile($temporaryPath.'/'.$fileName, $containerSources);
129+
}
130+
);
131+
132+
require $temporaryPath.'/LazyServiceProjectAsFilesServiceContainer.php';
133+
}
42134
}
43135

44136
class TestManagerRegistry extends ManagerRegistry

‎src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueEntityValidatorTest.php
+27Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
3838
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntityValidator;
3939
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
40+
use Symfony\Component\Validator\Exception\UnexpectedValueException;
4041
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
4142

4243
/**
@@ -859,6 +860,32 @@ public function testValidateUniquenessWithEmptyIterator($entity, $result)
859860
$this->assertNoViolation();
860861
}
861862

863+
public function testValueMustBeObject()
864+
{
865+
$constraint = new UniqueEntity([
866+
'message' => 'myMessage',
867+
'fields' => ['name'],
868+
'em' => self::EM_NAME,
869+
]);
870+
871+
$this->expectException(UnexpectedValueException::class);
872+
873+
$this->validator->validate('foo', $constraint);
874+
}
875+
876+
public function testValueCanBeNull()
877+
{
878+
$constraint = new UniqueEntity([
879+
'message' => 'myMessage',
880+
'fields' => ['name'],
881+
'em' => self::EM_NAME,
882+
]);
883+
884+
$this->validator->validate(null, $constraint);
885+
886+
$this->assertNoViolation();
887+
}
888+
862889
public function resultWithEmptyIterator(): array
863890
{
864891
$entity = new SingleIntIdEntity(1, 'foo');

0 commit comments

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