Commit Graph

38161 Commits

Author SHA1 Message Date
Nicolas Grekas
c2e0aab7be cs fix 2020-02-04 10:59:34 +01:00
Fabien Potencier
2e27353a19 minor #35584 Fix CS (fabpot)
This PR was merged into the 3.4 branch.

Discussion
----------

Fix CS

| Q             | A
| ------------- | ---
| Branch?       | 3.4 <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | n/a

Commits
-------

a3e49f30c7 Fix CS
2020-02-04 09:15:25 +01:00
Fabien Potencier
a3e49f30c7 Fix CS 2020-02-04 09:04:52 +01:00
Fabien Potencier
ce29631cd8 [Translation] Add missing use statement 2020-02-04 08:22:30 +01:00
Fabien Potencier
28eedb8cef bug #34123 [Form] Fix handling of empty_data's \Closure value in Date/Time form types (yceruto)
This PR was merged into the 3.4 branch.

Discussion
----------

[Form] Fix handling of empty_data's \Closure value in Date/Time form types

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #33188
| License       | MIT
| Doc PR        | -

Basically this would solve the posibility to pass a `\Closure` to the `empty_data` option for Date/Time form types.

> https://symfony.com/doc/current/reference/forms/types/form.html#empty-data
> If a form is compound, you can set empty_data as an array, object or **closure**. See the [How to Configure empty Data](https://symfony.com/doc/current/form/use_empty_data.html) for a Form Class article for more details about these options.

Also related to https://github.com/symfony/symfony/pull/29182

Commits
-------

4939f0e323 Fix handling of empty_data's \Closure value in Date/Time form types
2020-02-03 18:31:42 +01:00
Fabien Potencier
5b1a9cb51a minor #35552 [Translation][Debug] Add installation and minimal example to README (wouterj)
This PR was squashed before being merged into the 3.4 branch (closes #35552).

Discussion
----------

[Translation][Debug] Add installation and minimal example to README

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | n/a
| License       | MIT
| Doc PR        | -

At SymfonyCon, we decided to test out removing some component documentation from the official docs. These were duplicating quite some information of the main guides and were confusing people that used the components in the framework.

I think it's good to reintroduced the composer installation command and a very minimal example in the README's of the component. This doesn't require maintenance and can kickstart people to gain knowledge on how to use the component.

For now, we've (re)moved the Debug and Translation component docs, so that's why I've only modified those README's.

cc @symfony/team-symfony-docs

Commits
-------

b52b7b9fd6 [Translation][Debug] Add installation and minimal example to README
2020-02-03 16:10:46 +01:00
Wouter de Jong
b52b7b9fd6 [Translation][Debug] Add installation and minimal example to README 2020-02-03 16:10:40 +01:00
Fabien Potencier
ef4dcdb144 bug #35546 [Validator] check for __get method existence if property is uninitialized (alekitto)
This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] check for __get method existence if property is uninitialized

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35544
| License       | MIT

Resolve bug #35544.

On PHP 7.4, check if object implements `__get` magic method if property is reported as uninitialized before returning null.

Commits
-------

427bc3aa18 [Validator] try to call __get method if property is uninitialized
2020-02-03 12:20:41 +01:00
Alessandro Chitolina
427bc3aa18
[Validator] try to call __get method if property is uninitialized 2020-02-03 11:35:42 +01:00
Nicolas Grekas
af46fd6961 minor #35507 [DependencyInjection] Fix typo in test name (signor-pedro)
This PR was merged into the 3.4 branch.

Discussion
----------

[DependencyInjection] Fix typo in test name

Rename testThrowsExceptionWhenAddServiceOnACompiledContainer to testNoExceptionWhenAddServiceOnACompiledContainer.

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes (technically)
| New feature?  | no
| Deprecations? | no
| Tickets       | #35505
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Commits
-------

9cbfad5853 [DependencyInjection] #35505 Fix typo in test name
2020-02-03 11:21:26 +01:00
Nicolas Grekas
f758eca8b7 bug #35332 [Yaml][Inline] Fail properly on empty object tag and empty const tag (fancyweb)
This PR was merged into the 3.4 branch.

Discussion
----------

[Yaml][Inline] Fail properly on empty object tag and empty const tag

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Rework of https://github.com/symfony/symfony/pull/35208 to not end up in `parseScalar` with an empty string or a boolean (and thus, avoid unfriendly error such as `Trying to access array offset on value of type bool`).

Ping @xabbuh

Commits
-------

bdf02c0a7e [Yaml][Inline] Fail properly on empty object tag and empty const tag
2020-02-03 11:17:31 +01:00
Nicolas Grekas
1f053f99e4 bug #35489 [PhpUnitBridge] Fix running skipped tests expecting only deprecations (chalasr)
This PR was merged into the 3.4 branch.

Discussion
----------

[PhpUnitBridge] Fix running skipped tests expecting only deprecations

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

If a test class has unsatisfied `@requires` and contains test methods expecting deprecation only, you get:

> Fatal error: Uncaught Error: Call to a member function beStrictAboutTestsThatDoNotTestAnything() on null in ./symfony/symfony-dev/vendor/symfony/phpunit-bridge/Legacy/SymfonyTestsListenerTrait.php:229

Spotted in #34925's build.

Commits
-------

6b02362c5b [Phpunit] Fix running skipped tests expecting only deprecations
2020-02-03 11:14:10 +01:00
Robin Chalas
6b02362c5b [Phpunit] Fix running skipped tests expecting only deprecations 2020-02-03 11:13:58 +01:00
Fabien Potencier
51444877d1 bug #35161 [FrameworkBundle] Check non-null type for numeric type (Arman-Hosseini)
This PR was merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle] Check non-null type for numeric type

$maxAge and $sharedAge can both be zero

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| License       | MIT

Commits
-------

2797867ae9 Check non-null type for numeric type
2020-02-03 11:04:11 +01:00
Fabien Potencier
6c96706381 bug #34059 [DomCrawler] Skip disabled fields processing in Form (sbogx)
This PR was merged into the 3.4 branch.

Discussion
----------

[DomCrawler] Skip disabled fields processing in Form

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #28179
| License       | MIT

Commits
-------

c73b042044 bug symfony#28179 [DomCrawler] Skip disabled fields processing in Form
2020-02-03 11:01:18 +01:00
Fabien Potencier
a536342a96 bug #34114 [Console] SymonfyStyle - Check value isset to avoid PHP notice (leevigraham)
This PR was merged into the 3.4 branch.

Discussion
----------

[Console] SymonfyStyle - Check value isset to avoid PHP notice

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #34093
| License       | MIT
| Doc PR        | n/a

This PR addresses the issue when a default value is not a valid choice. Currently this would throw a notice which outputs to the console.

This fix is a similar implementation to the `QuestionHelper`: https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/Console/Helper/QuestionHelper.php#L63

Example console command and output can be found in the issue: #34093

Commits
-------

c9072c70ef Check value isset to avoid PHP notice
2020-02-03 10:58:05 +01:00
Nicolas Grekas
78641e0e88 bug #35557 [Config] dont catch instances of Error (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[Config] dont catch instances of Error

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35445, fix #35256
| License       | MIT
| Doc PR        | -

Commits
-------

e94c3fb87d [Config] dont catch instances of Error
2020-02-03 09:12:41 +01:00
Nicolas Grekas
e94c3fb87d [Config] dont catch instances of Error 2020-02-03 09:11:57 +01:00
Nicolas Grekas
e02e74d036 Update PR template 2020-02-01 11:00:56 +01:00
Nicolas Grekas
b2339b5e32 Bump phpunit-bridge cache 2020-01-31 10:55:33 +01:00
Fabien Potencier
aeea451433 bug #35532 [Validator] fix access to uninitialized property when getting value (greedyivan)
This PR was squashed before being merged into the 3.4 branch (closes #35532).

Discussion
----------

[Validator] fix access to uninitialized property when getting value

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35454
| License       | MIT
| Doc PR        |

In PHP 7.4, the type-hinted property is [uninitialized](https://wiki.php.net/rfc/typed_properties_v2#uninitialized_and_unset_properties) by default. So it needs to be checked before use.

Commits
-------

1edecf77c1 [Validator] fix access to uninitialized property when getting value
2020-01-31 09:56:30 +01:00
Ivan Grigoriev
1edecf77c1 [Validator] fix access to uninitialized property when getting value 2020-01-31 09:56:24 +01:00
Fabien Potencier
e50db1f93f bug #35305 [HttpKernel] Fix stale-if-error behavior, add tests (mpdude)
This PR was squashed before being merged into the 3.4 branch (closes #35305).

Discussion
----------

[HttpKernel] Fix stale-if-error behavior, add tests

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | #24248
| License       | MIT
| Doc PR        |

This PR adds the first tests for `stale-if-error` logic in `HttpCache`.

It also fixes an observation from #24248: For responses that have been cached as `public` with an `ETag` but without a lifetime, in case of an error the stale response will be served forever (= as long as the error persists), even beyond the configured `stale-if-error` grace period.

Furthermore, it tries to improve compliance with RFC 7234: Stale responses must not be sent (under no condition) if one of
* `no-cache`
* `must-revalidate`
* `proxy-revalidate` or
* `s-maxage` (sic) is present.

This can be found in the corresponding chapters of Section 5.2.2 for these directives, but is also summarized in [Section 4.2.4](https://tools.ietf.org/html/rfc7234#section-4.2.4) as

 > A cache MUST NOT generate a stale response if it is prohibited by an explicit in-protocol directive (e.g., by a "no-store" or "no-cache" cache directive, a "must-revalidate" cache-response-directive, or an applicable "s-maxage" or "proxy-revalidate" cache-response-directive; see Section 5.2.2).

Because disabling of `stale-if-error` for `s-maxage` responses probably has a big impact on the usefulness of that feature in practice, it has to be enabled explicitly with a new config setting `strict_smaxage` (defaulting to `false`).

Commits
-------

ad5f427bed [HttpKernel] Fix stale-if-error behavior, add tests
2020-01-30 17:05:58 +01:00
Matthias Pigulla
ad5f427bed [HttpKernel] Fix stale-if-error behavior, add tests 2020-01-30 17:05:53 +01:00
Signor Pedro
9cbfad5853
[DependencyInjection] #35505 Fix typo in test name
Rename testThrowsExceptionWhenAddServiceOnACompiledContainer to testNoExceptionWhenAddServiceOnACompiledContainer.
2020-01-29 11:07:44 +01:00
Nicolas Grekas
b90664ba18 minor #35472 [Security] Improved error message when no supported user provider is found (wouterj)
This PR was submitted for the 4.4 branch but it was merged into the 3.4 branch instead.

Discussion
----------

[Security] Improved error message when no supported user provider is found

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35435
| License       | MIT
| Doc PR        | -

Commits
-------

6b2db6dc30 Improved error message when no supported user provider is found
2020-01-27 10:47:05 +01:00
Wouter de Jong
6b2db6dc30 Improved error message when no supported user provider is found 2020-01-27 10:46:58 +01:00
Nicolas Grekas
d90a503160 minor #35450 Fix testing with mongodb (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

Fix testing with mongodb

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

28cd964ac9 Fix testing with mongodb
2020-01-23 11:33:58 +01:00
Nicolas Grekas
28cd964ac9 Fix testing with mongodb 2020-01-23 11:22:55 +01:00
Fabien Potencier
6aec780351 bumped Symfony version to 3.4.38 2020-01-21 14:12:52 +01:00
Fabien Potencier
1bd873459b
Merge pull request #35411 from fabpot/release-3.4.37
released v3.4.37
2020-01-21 13:30:09 +01:00
Fabien Potencier
10663730ae updated VERSION for 3.4.37 2020-01-21 13:29:51 +01:00
Fabien Potencier
c7333d0aa6 update CONTRIBUTORS for 3.4.37 2020-01-21 13:29:48 +01:00
Fabien Potencier
a3cc5e50c0 updated CHANGELOG for 3.4.37 2020-01-21 13:29:39 +01:00
Nicolas Grekas
fb0be81b7a bug #35065 [Security] Use supportsClass in addition to UnsupportedUserException (linaori)
This PR was merged into the 3.4 branch.

Discussion
----------

[Security] Use supportsClass in addition to UnsupportedUserException

| Q             | A
| ------------- | ---
| Branch?       | 3.4+
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35045
| License       | MIT
| Doc PR        | ~

This PR fixes the issue where user providers rely on just the UnsupportedUserException from `refreshUser()`, causing a flow where users are wrongfully re-authenticated.

There's one issue where `refreshUser()` can do far more sophisticated checks on the user class, which it will never reach if the class is not supported. As far as I know it was never intended to support instances that are rejected by `supportsClass()`, though people could've implemented this (by accident). So the question is more if we should add a BC layer for this; for example:

```php
try {
    $refreshedUser = $provider->refreshUser($user);
    $newToken = clone $token;
    $newToken->setUser($refreshedUser);

    if (!$provider->supportsClass($userClass)) {
        if ($this->shouldCheckSupportsClass) {
            continue;
        }
        // have to think of a proper deprecation here for 6.0
        @trigger_error('Provider %s does not support user class %s via supportsClass() while it does support it via refreshUser .. please set option X and fix %s::supportsUser() ', E_USER_DEPRECATED);
    }
```
This would prevent behavior from breaking but also means we can't fix this on anything less than 5.1.

Commits
-------

d3942cbe17 Use supportsClass where possible
2020-01-21 12:02:57 +01:00
Nicolas Grekas
ff174dfec3 minor #35178 [PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code (fancyweb)
This PR was merged into the 3.4 branch.

Discussion
----------

[PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Risky errors when there are no assertions are added before the test end listeners are called (ie, before the code in endTest is executed) so forcing beStrictAboutTestsThatDoNotTestAnything to false when there is a expectedDeprecation annotation is enough.

If the goal is to reset the value to the original value, then I think we should not do it since we basically "lie" to the next listeners. Let's assume that when a test expect a deprecation, it can have 0 assertions. Also this flag is not used anymore by PHPUnit after we reset it.

Ref https://github.com/symfony/symfony/pull/21786 btw

Commits
-------

fb48bbc05b [PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code
2020-01-20 13:28:41 +01:00
Nicolas Grekas
f889c1167f minor #35369 [Filesystem] chown and chgrp should also accept int as owner and group (3.4) (Slamdunk)
This PR was merged into the 3.4 branch.

Discussion
----------

[Filesystem] chown and chgrp should also accept int as owner and group (3.4)

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Reference: https://github.com/symfony/symfony/pull/35356#issuecomment-575526299

Commits
-------

6b811e6b4c chown and chgrp should also accept int as owner and group
2020-01-17 12:07:25 +01:00
Filippo Tessarotto
6b811e6b4c chown and chgrp should also accept int as owner and group 2020-01-17 09:50:08 +01:00
Thomas Calvet
bdf02c0a7e [Yaml][Inline] Fail properly on empty object tag and empty const tag 2020-01-16 20:04:26 +01:00
Fabien Potencier
b493997b71 minor #35340 [Validator] Fix plurals for sr_Latn validation messages (knezmilos13)
This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] Fix plurals for sr_Latn validation messages

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35276
| License       | MIT

validators.sr_Latn.xlf (Serbian, written with latin script) has wrong plurals for all validation message translations that require them (only two where there should be three). This commit fixes that by adding the missing third plural-translation.

Commits
-------

207cdafd54 [Validator] Fix plurals for sr_Latn (Serbian language written in latin script) validation messages
2020-01-16 10:23:40 +01:00
Robin Chalas
6cc377ff3d bug #35343 [Security] Fix RememberMe with null password (jderusse)
This PR was merged into the 3.4 branch.

Discussion
----------

[Security] Fix RememberMe with null password

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | yes
| Tickets       | NA
| License       | MIT
| Doc PR        | NA

From `UserInterface` the method getPassword may return null, while generateCookieHash requires a string.
This PR changes the signature of the methods to allows null password

Similar to #35335 for branch 3.4

Commits
-------

820eb357c8 Fix RememberMe with null password
2020-01-16 01:14:41 +01:00
Jérémy Derussé
820eb357c8
Fix RememberMe with null password 2020-01-14 22:28:32 +01:00
knezmilos13
207cdafd54 [Validator] Fix plurals for sr_Latn (Serbian language written in latin script) validation messages 2020-01-14 19:27:07 +01:00
Thomas Calvet
fb48bbc05b [PhpUnitBridge][SymfonyTestsListenerTrait] Remove some unneeded code 2020-01-14 15:27:59 +01:00
Fabien Potencier
db3134eba4 bug #35318 [Yaml] fix PHP const mapping keys using the inline notation (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Yaml] fix PHP const mapping keys using the inline notation

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #35179
| License       | MIT
| Doc PR        |

Commits
-------

45461c73bf fix PHP const mapping keys using the inline notation
2020-01-13 14:54:16 +01:00
Christian Flothmann
45461c73bf fix PHP const mapping keys using the inline notation 2020-01-13 09:00:59 +01:00
Fabien Potencier
764c91bd9f bug #35304 [HttpKernel] Fix that no-cache MUST revalidate with the origin (mpdude)
This PR was merged into the 3.4 branch.

Discussion
----------

[HttpKernel] Fix that no-cache MUST revalidate with the origin

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

From [RFC 7234 Section 5.2.2](https://tools.ietf.org/html/rfc7234#section-5.2.2)

> The "no-cache" response directive indicates that the response MUST NOT be used to satisfy a subsequent request without successful validation on the origin server.  This allows an origin server to prevent a cache from using it to satisfy a request without contacting it, even by caches that have been configured to send stale responses.

This is unconditional – the response must be revalidated right away.

(`must-revalidate`, to the contrary, requires revalidation only once the response has become stale.)

Commits
-------

c8bdcb3408 Fix that no-cache requires positive validation with the origin, even for fresh responses
2020-01-11 08:35:43 +01:00
Matthias Pigulla
c8bdcb3408 Fix that no-cache requires positive validation with the origin, even for fresh responses 2020-01-10 22:32:00 +00:00
Fabien Potencier
a0b976f28a bug #35299 Avoid stale-if-error in FrameworkBundle's HttpCache if kernel.debug = true (mpdude)
This PR was merged into the 3.4 branch.

Discussion
----------

Avoid `stale-if-error` in FrameworkBundle's HttpCache if kernel.debug = true

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #24248 (maybe?)
| License       | MIT
| Doc PR        |

When working with the `HttpCache` in development, error messages may not become visible if a `public` response has been successfully generated for the same URL before.

This is because the `HttpCache` from the `HttpKernel` component by default sets `stale_if_error` to 60 seconds.

At least when using the `HttpCache` subclass from the `FrameworkBundle`, we know about the `kernel.debug` setting and its intention to support local development. In that case, we could set the *default* `stale-if-error` value to 0.

Commits
-------

3a23ec89c3 Avoid stale-if-error if kernel.debug = true, because it hides errors
2020-01-10 12:27:06 +01:00
Matthias Pigulla
3a23ec89c3 Avoid stale-if-error if kernel.debug = true, because it hides errors 2020-01-10 10:52:55 +00:00