This PR was merged into the 5.3-dev branch.
Discussion
----------
[Notifier] Move abstract test cases to namespace
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no (only fixes builds)
| New feature? | yes (not sure about a changeling entry)
| 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 | no
This enables BC promise for the abstract test classes, like for other ones.
As we ignore current `/Tests` directory in `.gitattributes`, builds will fail if `symfony/notifier` is installed as dist.
Commits
-------
33ba3c755d [Notifier] Move abstract test cases to namespace
This PR was merged into the 5.2 branch.
Discussion
----------
Fixed parsing deprecated definitions without message key
| Q | A
| ------------- | ---
| Branch? | 5.2
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
### Steps to reproduce
1. Create service/alias definition and mark it as deprecated without specifying message key as shown in https://symfony.com/doc/5.2/service_container/alias_private.html#deprecating-service-aliases. For example:
```yaml
services:
service_without_deprecation_message:
class: Foo
deprecated:
package: vendor/package
version: 1.1
alias_without_deprecation_message:
alias: foobar
deprecated:
package: vendor/package
version: 1.1
```
2. Clear cache by running `php bin/console cache:clear`
### Actual behaviour
`Symfony\Component\Config\Exception\LoaderLoadException` exception is thrown with the following message: `Warning: Undefined array key "message" (...)`
See https://gist.github.com/adamwojs/5bac85d4326d8fbe6f52a357fa6e57e6 for full stactrace.
### Excepted behaviour
Given definitions are loaded correctly. Default service/alias deprecation message is used as shown in linked documentation page.
Commits
-------
d585b64953 Fixed parsing deprecated definitions without message key
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[Validator] Avoid triggering the autoloader for user-input values
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
Following-up to https://twitter.com/seldaek/status/1372450636361502721 - mostly to see if the build passes or if this breaks some undocumented/unclear-to-me assumptions.
Essentially using the `Valid` constraint should only validate objects if they exist as objects. If a user sends a string and that gets assigned to a property, `Valid` should not attempt autoloading that user-given string.
As far as I can tell, this is used in two places:
- acb32dd396/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php (L364-L365) where non-objects are anyway ignored, so this change is harmless there.
- acb32dd396/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php (L652-L660) where it's explicitly passing anything in there to get the proper exception, so my change makes sure that exception is thrown *before* autoloading attempts. I am just not 100% sure if there are cases where validateGenericNode will receive a class name as a string to validate in $value. I can't imagine why it would but that doesn't mean it's true.
Commits
-------
e45eb23ba2 [Validator] Avoid triggering the autoloader for user-input values
This enables BC promise for the abstract test classes, like for other ones.
As we ignore current `/Tests` directory in `.gitattributes`, builds will fail if `symfony/notifier` is installed as dist.
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Runtime] make GenericRuntime ... generic
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
This PR will allow #40436 to move to https://github.com/symfony/psr-http-message-bridge
For the record, it builds on a prototype I wrote almost one year ago at https://github.com/tchwork/bootstrapper.
This PR makes the `GenericRuntime` implementation able to auto-discover runtime implementations for specific types.
It uses the autoloader for the discovery: when a closure-app requires or returns a type `Vendor\Foo`, it will use a convention and check if the class `Symfony\Runtime\Vendor\FooRuntime` exists. If yes, it will use it to resolve the corresponding type. Such runtime classes have to extend `GenericRuntime` so that they can use the protected API it provides. This requirement is aligned with the fact that the very convention proposed here is an implementation detail that works when using a `GenericRuntime` as the main runtime (This behavior can be overridden by providing explicit entries in the new `runtimes` option when booting the `GenericRuntime`.)
`SymfonyRuntime` can be used as both the main runtime or a type-specific runtime:
- when used as the main runtime, it configures the typical global-state for Symfony and has a fast codepath for Symfony types, while still being generic.
- it can also be used in another runtime as a way to resolve Symfony types (would typically be useful to #40436 for running Console apps in a PSR-based web app.)
Commits
-------
33e371e24d [Runtime] make GenericRuntime ... generic
* 5.2:
[HttpKernel] do is_file check before include
[PhpUnitBridge] fix reporting deprecations from DebugClassLoader
[FrameworkBundle] skip deprecation in integration tests
enable HTTP method overrides as early as possible with the HTTP cache
* 4.4:
[HttpKernel] do is_file check before include
[PhpUnitBridge] fix reporting deprecations from DebugClassLoader
[FrameworkBundle] skip deprecation in integration tests
This PR was squashed before being merged into the 5.3-dev branch.
Discussion
----------
[Form] Add "form_attr" FormType option
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? |no
| New feature? | yes
| Deprecations? | no
| Tickets | N/A
| License | MIT
| Doc PR | [#15108](https://github.com/symfony/symfony-docs/pull/15108)
## What is this about
This PR add support for [`form` attribute](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fae-form) to Symfony Form ([browser compatibility](https://caniuse.com/form-attribute)).
The `form` attribute allows form elements to override their associated form (which is their nearest ancestor form element by default). This is extremely useful to solve **nested form problem** and allows **form children** to be **rendered outside form tag** while still working as expected.
## New "form_attr" FormType option
#### form_attr
**type**: `bool` or `string` **default**: `false`
If set to `true` on a **root form**, adds [`form` attribute](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fae-form) on every children with their root **form id**.
This allows you to render form children outside the form tag and avoid **nested form problem** in some situations while keeping the form working properly.
If set to `true` on a **child**, adds [`form` attribute](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fae-form) on it with its **root form id**.
This allows you to render **that child** outside the form tag and avoid **nested form problem** in some situations while keeping the form working properly.
If root form has no `id` (this may happen by create an *unnamed* form), you can set it to a `string` identifier to be used at `FormView` level to link children and root form anyway.
## Usage on Root Form Example
#### Form Type
Enable the feature by setting `form_attr` to `true` on the root form.
```php
use Symfony\Component\Form\Extension\Core\Type;
class ListFilterType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('search', Type\SearchType::class)
->add('orderBy', Type\ChoiceType::class, [
'choices' => [
// ...
],
])
->add('perPage', Type\ChoiceType::class, [
'choices' => [
// ...
],
])
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefault('form_attr', true); // <--- Set this to true
}
}
```
#### Twig
The following Twig template **works properly** even if form children are **outside** their form tag ([browser compatibility](https://caniuse.com/form-attribute)).
```twig
<div class="header-filters">
{{ form_errors(form) }}
{{ form_row(form.search) }} {# has attribute form="list_filter" #}
{{ form_row(form.orderBy) }} {# has attribute form="list_filter" #}
</div>
<!-- -->
<!-- Some other HTML content, like a table or even another Symfony form -->
<!-- -->
<div class="footer-filters">
{{ form_row(form.perPage) }} {# has attribute form="list_filter" #}
</div>
{{ form_start(form) }} {# id="list_filter" #}
{{ form_end(form) }}
```
✅ Every form elements work properly even outside form tag.
## Usage on Form Child Example
Enable the feature by setting `form_attr` to `true` on selected child.
```php
use Symfony\Component\Form\Extension\Core\Type;
class ListFilterType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('search', Type\SearchType::class)
->add('orderBy', Type\ChoiceType::class, [
'choices' => [
// ...
],
])
->add('perPage', Type\ChoiceType::class, [
'form_attr' => true, // <--- Set this to true
'choices' => [
// ...
],
])
}
}
```
#### Twig
The following Twig template **works properly** even if `form.perPage` is **outside** form tag ([browser compatibility](https://caniuse.com/form-attribute)).
```twig
<div class="header-filters">
{{ form_start(form) }} {# id="list_filter" #}
{{ form_errors(form) }}
{{ form_row(form.search) }}
{{ form_row(form.orderBy) }}
{{ form_end(form, {'render_rest': false}) }}
</div>
<!-- -->
<!-- Some other HTML content, like a table or even another Symfony form -->
<!-- -->
<div class="footer-filters">
{{ form_row(form.perPage) }} {# has attribute form="list_filter" #}
</div>
```
✅ `form.perPage` element work properly even outside form tag.
Commits
-------
5f913cec74 [Form] Add "form_attr" FormType option
This PR was squashed before being merged into the 5.3-dev branch.
Discussion
----------
[Validator] Add normalizer option to Unique constraint
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | yes
| Deprecations? | no
| Tickets | #37451
| License | MIT
| Doc PR | todo
Hello! Reopening my PR #37507 with target branch `5.x`
This PR is about https://github.com/symfony/symfony/issues/37451. The idea is to make that constraint more flexible and able to process business rules, especially when working with objects. We can think about it as the similar feature in UniqueEntity constraint, when we declare on which attributes we are applying the constraint. But in our case it is more general - we pass a callable with whatever logic we want to apply to collection elements before we apply 'uniqueness check' :)
Looks like no BC breaks. Thanks! :)
Commits
-------
44e1e8bc9b [Validator] Add normalizer option to Unique constraint
* 5.2:
[Console] Fix line wrapping for decorated text in block output
[Inflector] Fixed pluralize "coupon"
[PhpUnitBridge] fix compat with symfony/debug
[VarDumper] Adds support for ReflectionUnionType to VarDumper
Correctly clear lines for multi-line progress bar messages.
[Security] Add XML support for authenticator manager
* 4.4:
[Console] Fix line wrapping for decorated text in block output
[Inflector] Fixed pluralize "coupon"
[PhpUnitBridge] fix compat with symfony/debug
[VarDumper] Adds support for ReflectionUnionType to VarDumper
Correctly clear lines for multi-line progress bar messages.
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[Console] Fix line wrapping for decorated text in block output
| Q | A
| ------------- | ---
| Branch? |
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| License | MIT
Fixed bug that caused decorated text to be wrapped too early in SymfonyStyle->block().
Commits
-------
760be88310 [Console] Fix line wrapping for decorated text in block output
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Runtime] Remove "docs" from readme
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR | https://github.com/symfony/symfony-docs/pull/15081
Make the readme of the Runtime component link to the docs. This PR is blocked by the doc PR.
Commits
-------
6f4552fcec [Runtime] Remove "docs" from readme
This PR was squashed before being merged into the 4.4 branch.
Discussion
----------
[VarDumper] Adds support for ReflectionUnionType to VarDumper
Fixes a bug with VarDumper when dumping a ReflectionUnionType.
> PHP Error: Call to undefined method ReflectionUnionType::isBuiltin()
Notes:
* One of the existing tests relies on its position in the test file. I had to modify its expected line number.
* There is an existing trailing space around line 367 in an expected value.
I'm not sure if this was left for BC reasons but it seems like a bug if the dumper is leaving trailing spaces.
| Q | A
| ------------- | ---
| Branch? | 4.4
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
This commit fixes a crash when dumping ReflectionUnionType. The code is minimal but uses a few extra lines to preserve key order for bc and consistency. Additionally, there is an else condition that is currently unreachable but is defensive should they add additional subtypes of ReflectionType. Tests are included. Please let me know if you have any questions or suggestions. Thanks for Symfony it's a wonderful project.
Commits
-------
1a11491f6e [VarDumper] Adds support for ReflectionUnionType to VarDumper
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Mailer] Add supported auth modes to exception
| Q | A
| ------------- | ---
| Branch? | 4.4+
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Tickets |
| License | MIT
| Doc PR |
If there is no match for the available authenticators the thrown exception now includes the supported auth methods as reported by the server.
Commits
-------
d9c99d86ab [Mailer] Add supported auth modes to exception
This PR was merged into the 5.3-dev branch.
Discussion
----------
[Security] Fix BC layer
| Q | A
| ------------- | ---
| Branch? | 5.x
| Bug fix? | no
| New feature? | no
| Deprecations? | no
| Tickets | -
| License | MIT
| Doc PR | -
Tests were broken because no password hasher was configured for the new `InMemoryUser` class in configs on lower branches.
This PR fixes it by making the new class extend the deprecated one, so that the password hasher factory is able to find a password hasher for it (instanceof-based match).
Commits
-------
2d7f7b5072 [Security] Fix BC layer