This PR was merged into the 4.4 branch.
Discussion
----------
[DoctrineBridge] Fix invalid guess with enumType
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Since https://github.com/doctrine/orm/pull/9304 doctrine allows Enums with the new `enumType` option.
ie.
```php
#[ORM\Column(type: 'string', enumType: Status::class, length: 1)]
public Status $status;
```
The issue is, it break validations at several places:
- `doctrinerExtractor` guess it's a `string` (Because of `type = string`), and validation adds the constraint `Assert\Type(string)`
- `doctrineLoader` guess it's a string with a maxLength and validation adds a constrain `Assert\Length(max=1)`
-
Commits
-------
68dd21881f Fix invalid guess with enumType
This PR was merged into the 4.4 branch.
Discussion
----------
[HttpClient] fix resetting DNS/etc when calling CurlHttpClient::reset()
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#44900
| License | MIT
| Doc PR | -
This PR reverts #44625 and uses a new curl-share handle instead to reset any state.
Commits
-------
d4266464fe [HttpClient] fix resetting DNS/etc when calling CurlHttpClient::reset()
This PR was merged into the 5.3 branch.
Discussion
----------
[HttpClient] Remove deprecated usage of GuzzleHttp\Promise\promise_for
| Q | A
| ------------- | ---
| Branch? | 5.3,
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Similar to https://github.com/symfony/symfony/pull/44890 but this function was introduced in 5.1 https://github.com/symfony/symfony/pull/37927
Commits
-------
3d2ed700eb [HttpClient] Remove deprecated usage of GuzzleHttp\Promise\promise_for
* 5.4:
[HttpClient] Remove deprecated usage of `GuzzleHttp\Promise\queue`
[PropertyAccess] Fix handling of uninitialized property of anonymous class
[FrameworkBundle] Allow default cache pools to be overwritten by user
[DependencyInjection] fix test
ResolveBindingsPass remove loading of class iterable
[FrameworkBundle] Avoid calling rtrim(null, '/') in AssetsInstallCommand
Optimization of resolveEnvPlaceholders
Fix incorrect format
[DependencyInjection] Fix nested env var with resolve processor
Allow OutputFormatter::escape() to be used for escaping URLs used in <href>
allow a zero time-limit
Use correct tag for ExpoTransportFactory service
[DependencyInjection] Ignore argument type check in CheckTypeDeclarationsPass if it's a Definition with a factory
[Validators] Add translations for Slovak #43735
* 5.3:
[HttpClient] Remove deprecated usage of `GuzzleHttp\Promise\queue`
[PropertyAccess] Fix handling of uninitialized property of anonymous class
[FrameworkBundle] Allow default cache pools to be overwritten by user
[DependencyInjection] fix test
ResolveBindingsPass remove loading of class iterable
[FrameworkBundle] Avoid calling rtrim(null, '/') in AssetsInstallCommand
[DependencyInjection] Fix nested env var with resolve processor
Allow OutputFormatter::escape() to be used for escaping URLs used in <href>
allow a zero time-limit
[DependencyInjection] Ignore argument type check in CheckTypeDeclarationsPass if it's a Definition with a factory
[Validators] Add translations for Slovak #43735
This PR was merged into the 5.3 branch.
Discussion
----------
[FrameworkBundle] Allow default cache pools to be overwritten by user
| Q | A
| ------------- | ---
| Branch? | 5.3
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fixes https://github.com/symfony/symfony/issues/44984
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
<!--
Replace this notice by a short README for your feature/bugfix.
This will help reviewers and should be a good start for the documentation.
Additionally (see https://symfony.com/releases):
- Always add tests and ensure they pass.
- Bug fixes must be submitted against the lowest maintained branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too.)
- Features and deprecations must be submitted against the latest branch.
- Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
- Never break backward compatibility (see https://symfony.com/bc).
-->
Commits
-------
cc7cf5a4a6 [FrameworkBundle] Allow default cache pools to be overwritten by user
* 4.4:
[HttpClient] Remove deprecated usage of `GuzzleHttp\Promise\queue`
[PropertyAccess] Fix handling of uninitialized property of anonymous class
[DependencyInjection] fix test
ResolveBindingsPass remove loading of class iterable
[FrameworkBundle] Avoid calling rtrim(null, '/') in AssetsInstallCommand
[DependencyInjection] Fix nested env var with resolve processor
Allow OutputFormatter::escape() to be used for escaping URLs used in <href>
allow a zero time-limit
[DependencyInjection] Ignore argument type check in CheckTypeDeclarationsPass if it's a Definition with a factory
[Validators] Add translations for Slovak #43735
This PR was submitted for the 5.4 branch but it was merged into the 4.4 branch instead.
Discussion
----------
[HttpClient] Remove deprecated usage of `GuzzleHttp\Promise\queue`
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
`GuzzleHttp\Promise\queue` was deprecated in `1.4.0` in favour of `GuzzleHttp\Promise\Utils::queue`, to enable PSR-4 compliance and eliminate issues with multiple installs globally and locally. Since the minimum version of this package in Symfony's composer.json is `1.4.0` (`^1.4`), then this change should be safe to make.
---
cc `@Nyholm`
Commits
-------
5130dd590a [HttpClient] Remove deprecated usage of `GuzzleHttp\Promise\queue`
This PR was merged into the 4.4 branch.
Discussion
----------
[PropertyAccess] Fix handling of uninitialized property of anonymous class
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#44983
| License | MIT
| Doc PR | -
Commits
-------
27d5edf3d2 [PropertyAccess] Fix handling of uninitialized property of anonymous class
This PR was submitted for the 5.4 branch but it was merged into the 4.4 branch instead.
Discussion
----------
[DependencyInjection] Add iterable to possible binding type
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| License | MIT
When iterable type is set in binding like in example https://symfony.com/doc/current/service_container.html#binding-arguments-by-name-or-type, system tries to autoload class iterable here src/Symfony/Component/DependencyInjection/Compiler/ResolveBindingsPass.php:137
```
if (is_subclass_of($m[1], \UnitEnum::class)) {
```
Commits
-------
f9f78c7c2a ResolveBindingsPass remove loading of class iterable
This PR was squashed before being merged into the 6.0 branch.
Discussion
----------
[Serializer] Fix AbstractObjectNormalizer TypeError on denormalization
| Q | A
| ------------- | ---
| Branch? | 6.0
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#44872
| License | MIT
| Doc PR |
When using dependency injection to get the serializer (instead of manually instantiating it) the object normalizer that is injected into that serializer throws a value exception when doing denormalizing the following:
```php
class ObjectOuter {
public ObjectInner $inner;
}
class ObjectInner {
public $foo;
}
public function testDenormalizeRecursiveWithObjectAttributeWithStringValue()
{
$extractor = new ReflectionExtractor();
$normalizer = new ObjectNormalizer(null, null, null, $extractor);
$serializer = new Serializer([$normalizer]);
$obj = $serializer->denormalize(['inner' => 'foo'], ObjectOuter::class);
$this->assertInstanceOf(ObjectInner::class, $obj->getInner());
}
```
This throws
```php
TypeError:
Symfony\Component\Serializer\Normalizer\AbstractNormalizer::prepareForDenormalization(): Argument #1 ($data) must be of type object|array|null, string given, called in /var/www/symfony/vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php on line 368
at vendor/symfony/serializer/Normalizer/AbstractNormalizer.php:299
at Symfony\Component\Serializer\Normalizer\AbstractNormalizer->prepareForDenormalization('test string')
(vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php:368)
at Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer->denormalize('test string', 'App\\Entity\\User', null, array('cache_key' => 'c93a6d4efa206ea58a62cc6b7fab8dfb', 'deserialization_path' => 'author'))
(vendor/symfony/serializer/Serializer.php:238)
at Symfony\Component\Serializer\Serializer->denormalize('test string', 'App\\Entity\\User', null, array('cache_key' => 'c93a6d4efa206ea58a62cc6b7fab8dfb', 'deserialization_path' => 'author'))
(vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php:559)
at Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer->validateAndDenormalize(array(object(Type)), 'App\\Entity\\Blog', 'author', 'test string', null, array('cache_key' => '44db5a926a1544b1a8585af40107ca3a', 'deserialization_path' => 'author'))
(vendor/symfony/serializer/Normalizer/AbstractObjectNormalizer.php:401)
at Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer->denormalize(array('author' => 'test string'), 'App\\Entity\\Blog', null, array('cache_key' => '44db5a926a1544b1a8585af40107ca3a'))
(vendor/symfony/serializer/Serializer.php:238)
at Symfony\Component\Serializer\Serializer->denormalize(array('author' => 'test string'), 'App\\Entity\\Blog')
(src/Controller/BugReproductionController.php:18)
at App\Controller\BugReproductionController->test(object(Serializer))
(vendor/symfony/http-kernel/HttpKernel.php:152)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/symfony/http-kernel/HttpKernel.php:74)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/symfony/http-kernel/Kernel.php:202)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35)
at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
(vendor/autoload_runtime.php:29)
at require_once('/var/www/symfony/vendor/autoload_runtime.php')
(public/index.php:5)
```
Refer to: https://github.com/symfony/symfony/pull/44881 for the description.
Was in the middle of changing the base branch and accidentally pushed when the branch was deleted.
`@fancyweb` I implemented the requested changes
Commits
-------
89092ea279 [Serializer] Fix AbstractObjectNormalizer TypeError on denormalization
This PR was merged into the 5.4 branch.
Discussion
----------
[DependencyInjection] Optimization of resolveEnvPlaceholders
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| License | MIT
When you have to much env variables and many services in your container, container compilаtion can take much time due to the function stripos which is called much time.
Look at the bottom of picture https://i2.piccy.info/i9/cdc413af9aecce8f7ed5ca0fe69b6c7c/1640950765/149173/1453384/6833Screenshot_from_2021_12_31_13_38_20.png
It happens because function resolveEnvPlaceholders try to find env placeholders in any value, even when there is no possible env in string.
So i offer to check value on strings env_ or env( and if they are present than look for placeholders.
In my project it helps me to save 10 seconds in container building.
Commits
-------
f73b5aa479 Optimization of resolveEnvPlaceholders
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[FrameworkBundle] Avoid calling rtrim(null, '/') in AssetsInstallCommand
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| License | MIT
Avoid following deprecation notice:
```
php.INFO: Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated
```
Commits
-------
3d92f987dc [FrameworkBundle] Avoid calling rtrim(null, '/') in AssetsInstallCommand
This PR was merged into the 4.4 branch.
Discussion
----------
[DependencyInjection] Ignore argument type check in CheckTypeDeclarationsPass if it's a Definition with a factory
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | https://github.com/symfony/symfony/issues/35599, https://github.com/symfony/symfony/issues/44515
| License | MIT
| Doc PR | -
When a definition uses a factory, we don't know what it returns.
Commits
-------
b9095e6c09 [DependencyInjection] Ignore argument type check in CheckTypeDeclarationsPass if it's a Definition with a factory
This PR was merged into the 5.4 branch.
Discussion
----------
Use correct tag for ExpoTransportFactory service
| Q | A
| ------------- | ---
| Branch? | 5.4
| Bug fix? | yes
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | Fix#44833 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | -
<!--
Replace this notice by a short README for your feature/bugfix.
This will help reviewers and should be a good start for the documentation.
Additionally (see https://symfony.com/releases):
- Always add tests and ensure they pass.
- Bug fixes must be submitted against the lowest maintained branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too.)
- Features and deprecations must be submitted against the latest branch.
- Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
- Never break backward compatibility (see https://symfony.com/bc).
-->
Commits
-------
1d06c4e5de Use correct tag for ExpoTransportFactory service
This PR was merged into the 4.4 branch.
Discussion
----------
Allow a zero time-limit for messenger:consume
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
By default `messenger:consume` will run indefinitely and as the docs mention you should monitor the process via Supervisor for example. However on shared hostings this is usually not an option and thus this command will be run via a cronjob there (at least I assume that's the intended best practise in such a case). To ensure the worker exits for each cronjob run, you can use the `--time-limit` option, e.g.
```
bin/console messenger:consume --time-limit=1
```
However, this would allow the worker to consume multiple message for the duration of 1000ms - so technically if you want the worker to _immediately_ exit each time after it processed the current message queue it should actually be
```
bin/console messenger:consume --time-limit=0
```
But this does not currently work, as the zero is falsey and thus the `StopWorkerOnTimeLimitListener` will not actually be added.
This PR fixes that by checking whether the option was actually supplied or not.
Commits
-------
2668c0db2f allow a zero time-limit
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[DependencyInjection] Fix nested env var with resolve processor
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix#44756
| License | MIT
| Doc PR |
This PR fixes the issue raised by `@ro0NL`. (see Description)
I added some tests but i'm not confident about how to check with real environment variables.
This is my first PR, i hope i'm not doing it wrong.
Commits
-------
b2a61eec71 [DependencyInjection] Fix nested env var with resolve processor
This PR was merged into the 4.4 branch.
Discussion
----------
[Console] Allow OutputFormatter::escape() to be used for escaping URLs used in <href>
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
| Doc PR | symfony/symfony-docs#... <!-- required for new features -->
I was trying to use escape() to make user-provided URLs safe in `<href=...>` but I realized it was really only good for avoid starting tags, and not for escaping the content of a tag.
- escape() now escapes `>` as well as `<`
- URLs containing escaped `<`, `>` are now rendered correctly
- user-provided URLs should now be safe to use (as in they cannot break the formatting) as long as they're piped through `escape()`
- possibly also resolves issues if you were trying to use user-provided colors i.e. `'<'.OutputFormatter::escape($color).'>'` where as in current released code it would not help you at all here. I haven't checked that yet
I am happy to spend time adding tests but would like to first get feedback on the changes to know if it's reasonable or not to change `escape()` in this way.
The rest of the changes I think are absolutely safe to merge and make sense regardless.
Commits
-------
cfa8910dc7 Allow OutputFormatter::escape() to be used for escaping URLs used in <href>
- escape() now escapes `>` as well as `<`
- URLs containing escaped `<` and `>` are rendered correctly as is
- user-provided URLs should now be safe to use (as in they cannot break the formatting) as long as they're piped through `escape()`