Commit Graph

45384 Commits

Author SHA1 Message Date
Grégoire Pineau
1eb10b996a [Workflow] Fixed BC break on WorkflowInterface 2019-10-03 18:20:08 +02:00
Fabien Potencier
76e5ea85b4 minor #33809 [HttpKernel] Inherit Throwable in HttpExceptionInterface (nesk)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpKernel] Inherit Throwable in HttpExceptionInterface

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| **BC BREAKS?**| **YES**
| Tickets       | n/a
| License       | MIT
| Doc PR        | n/a

When using a static analysis tools, it is not possible to do this:

```php
if ($exception instanceof HttpExceptionInterface) {
    $exception->getStatusCode();
    $exception->getHeaders();
    $exception->getMessage(); //  Will fail here
}
```

This is due to `getMessage()` not being a method declared in `HttpExceptionInterface`. Since Symfony now requires PHP 7.1+ to run, it is safe to inherit from the `Throwable` interface (added in PHP 7.0).

### About backward compatibility

Adding new methods to `HttpExceptionInterface` [breaks BC](https://symfony.com/doc/current/contributing/code/bc.html#changing-interfaces), however this interface shouldn't be used on a class other than an exception, so this shouldn't affect much code.

### About tests

I'm not sure this really needs tests, but maybe I'm wrong? Tell me what to test if you think this is required.

Commits
-------

2ac3fbf232 Inherit Throwable in HttpExceptionInterface
2019-10-03 15:58:24 +02:00
Yonel Ceruto
4288f1c9f9 Fix wrong expression language value 2019-10-03 09:23:52 -04:00
Robin Chalas
8622c8c95e bug #33799 [Security]: Don't let falsy usernames slip through impersonation (j4nr6n)
This PR was merged into the 3.4 branch.

Discussion
----------

[Security]: Don't let falsy usernames slip through impersonation

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

When you try to impersonate users with a falsy username, `SwitchUserListener::handle()` would `return;` and impersonation would fail.

I'm using a third party OAuth provider that allows users to change their usernames with no guaranteed protection against re-use. To overcome that issue, I implemented `UserLoaderInterface::loadUserByUsername()` and query by a `providerId`.

After loading development fixtures, One user has `0` as it's `providerId`.

Commits
-------

64aecab0a7 Don't let falsey usernames slip through
2019-10-03 14:19:04 +02:00
Tobias Schultze
b2d6c10ba7 minor #33709 Add types to constructors and private/final/internal methods (Batch II) (derrabus)
This PR was squashed before being merged into the 4.4 branch (closes #33709).

Discussion
----------

Add types to constructors and private/final/internal methods (Batch II)

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | #32179, #33228
| License       | MIT
| Doc PR        | N/A

Followup to #33519, this time with:
* Form
* HttpClient
* HttpKernel
* intl
* Ldap
* Ldap
* Lock
* Messenger
* Processor
* PropertyInfo
* Routing
* Security
* Serializer
* Stopwatch
* Translation

Commits
-------

9378eb4858 Add types to constructors and private/final/internal methods (Batch II)
2019-10-03 13:24:15 +02:00
Alexander M. Turek
9378eb4858 Add types to constructors and private/final/internal methods (Batch II) 2019-10-03 13:24:03 +02:00
Nicolas Grekas
9adef0795f minor #33821 Fixed invalid VarDumper upgrade-4.0 doc. (adrozdek)
This PR was submitted for the 4.3 branch but it was merged into the 3.4 branch instead (closes #33821).

Discussion
----------

Fixed invalid VarDumper upgrade-4.0 doc.

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| 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

Updated upgrade-4.0 documentation to reflect actual changes in the code.

Commits
-------

afefc7104e Fixed invalid VarDumper upgrade doc.
2019-10-03 11:42:28 +02:00
Agata
afefc7104e Fixed invalid VarDumper upgrade doc. 2019-10-03 11:42:21 +02:00
Johann Pardanaud
2ac3fbf232 Inherit Throwable in HttpExceptionInterface 2019-10-03 10:14:32 +02:00
Nicolas Grekas
35f319caeb minor #33824 [WebProfilerBundle] Fix TemplateManager test (fancyweb)
This PR was merged into the 5.0-dev branch.

Discussion
----------

[WebProfilerBundle] Fix TemplateManager test

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

Commits
-------

d1ed9685e1 [WebProfilerBundle] Fix TemplateManager test
2019-10-03 09:46:52 +02:00
Thomas Calvet
d1ed9685e1 [WebProfilerBundle] Fix TemplateManager test 2019-10-03 09:40:48 +02:00
Robin Chalas
732c0344ea bug #33819 Fixing 'TypeError' in LdapUser::getSalt() (linnit)
This PR was merged into the 4.4 branch.

Discussion
----------

 Fixing 'TypeError' in LdapUser::getSalt()

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

The following TypeError is returned as LdapUser::getSalt() returns no value.

Return value of Symfony\Component\Ldap\Security\LdapUser::getSalt() must be of the type string or null, none returned

Commits
-------

28e30b132b  Fixing 'TypeError' in LdapUser::getSalt()
2019-10-02 22:02:04 +02:00
Ryan Linnit
28e30b132b
Fixing 'TypeError' in LdapUser::getSalt()
Return value of Symfony\Component\Ldap\Security\LdapUser::getSalt() must be of the type string or null, none returned
2019-10-02 20:38:58 +01:00
Nicolas Grekas
67fe198a8e feature #33628 [DependencyInjection] added Ability to define a priority method for tagged service (lyrixx)
This PR was merged into the 4.4 branch.

Discussion
----------

[DependencyInjection] added Ability to define a priority method for tagged service

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

Commits
-------

c1917c2999 [DependencyInjection] added Ability to define a priority method for tagged service
2019-10-02 21:24:21 +02:00
Nicolas Grekas
ebda9d1ae7 minor #33808 [Console] Throw a TypeError for non-int return value calling Command::execute() (jschaedl)
This PR was merged into the 5.0-dev branch.

Discussion
----------

[Console] Throw a TypeError for non-int return value calling Command::execute()

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | yes <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #33747 <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | - <!-- required for new features -->

### Todo

- [x] needs to be rebased after 4.4 was merged into master (see: https://github.com/symfony/symfony/pull/33805)

Commits
-------

b3a3b0c235 [Console] Throw a TypeError for non-int return values on calling Command::execute()
2019-10-02 19:22:46 +02:00
Jan Schädlich
b3a3b0c235 [Console] Throw a TypeError for non-int return values on calling Command::execute() 2019-10-02 19:22:19 +02:00
Nicolas Grekas
95ebca5213 Merge branch '4.4'
* 4.4:
  fix typo
2019-10-02 19:19:42 +02:00
Nicolas Grekas
3b1655165e fix typo 2019-10-02 19:19:36 +02:00
Nicolas Grekas
1e4d873c13 feature #33768 [String] Introduce a locale-aware Slugger in the String component (tgalopin)
This PR was merged into the 5.0-dev branch.

Discussion
----------

[String] Introduce a locale-aware Slugger in the String component

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

This PR introduces a locale-aware Slugger in the new String component, based on transliterators provided by the PHP intl extension (or iconv if not available). It also wires this Slugger in the FrameworkBundle in order to use it easily as a service and to automatically inject the proper locale into it to choose the appropriate transliteration depending on the Request locale.

See https://github.com/unicode-org/cldr/tree/master/common/transforms for CLDR mappings.

Commits
-------

056d8ceed9 [String] Introduce a locale-aware Slugger in the String component with FrameworkBundle wiring
2019-10-02 18:39:31 +02:00
Titouan Galopin
056d8ceed9 [String] Introduce a locale-aware Slugger in the String component with FrameworkBundle wiring 2019-10-02 18:31:43 +02:00
Nicolas Grekas
e7f70415a5 bug #33814 [HttpFoundation] Check if data passed to SessionBagProxy::initialize is an array (mynameisbogdan)
This PR was submitted for the 4.3 branch but it was merged into the 3.4 branch instead (closes #33814).

Discussion
----------

[HttpFoundation] Check if data passed to SessionBagProxy::initialize is an array

[HttpFoundation] Check if data passed to SessionBagProxy::initialize is an array

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| 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 #33769 <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Always add tests and ensure they pass.
 - Never break backward compatibility (see https://symfony.com/bc).
 - 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 branch 4.4.
 - Legacy code removals go to the master branch.
-->

If `$_SESSION['_sf2_attributes']` is set to a string, `SessionBagProxy::initialize` will throw an error since it's argument is type-hinted as array. So this change is to check before if the data to be passed is truly an array.

Commits
-------

38782bceff [HttpFoundation] Check if data passed to SessionBagProxy::initialize is an array
2019-10-02 18:15:28 +02:00
bogdan
38782bceff [HttpFoundation] Check if data passed to SessionBagProxy::initialize is an array 2019-10-02 18:15:21 +02:00
Nicolas Grekas
4a547c5663 bug #33815 [Workflow] Fixed default marking store value of Workflow (lyrixx)
This PR was merged into the 5.0-dev branch.

Discussion
----------

[Workflow] Fixed default marking store value of Workflow

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

Commits
-------

a2330b7a90 [Workflow] Fixed default marking store value of Workflow
2019-10-02 18:13:01 +02:00
Nicolas Grekas
7db04f1248 Merge branch '4.4'
* 4.4:
  fix merge
2019-10-02 18:10:14 +02:00
Grégoire Pineau
a2330b7a90 [Workflow] Fixed default marking store value of Workflow 2019-10-02 17:57:26 +02:00
Grégoire Pineau
c1917c2999 [DependencyInjection] added Ability to define a priority method for tagged service 2019-10-02 17:30:24 +02:00
Nicolas Grekas
d7e5dd120b Merge branch '4.3' into 4.4
* 4.3:
  fix merge
2019-10-02 17:04:54 +02:00
Nicolas Grekas
766162c4c7 fix merge 2019-10-02 17:03:35 +02:00
Nicolas Grekas
3ee9dbd17b Merge branch '4.4'
* 4.4: (24 commits)
  [Console] Command::execute() should always return int - deprecate returning null
  [FrameworkBundle] Fix wrong returned status code in ConfigDebugCommand
  [AnnotationCacheWarmer] add RedirectController to annotation cache
  [WebProfilerBundle] Try to display the most useful panel by default
  Add note about deprecating the XmlEncoder::TYPE_CASE_ATTRIBUTES constant in the upgrade guide
  fix merge
  [DI] add tests loading calls with returns-clone
  [DI] dont mandate a class on inline services with a factory
  Fixed Redis Sentinel usage when only one Sentinel specified
  [EventDispatcher] Added tests for aliased events.
  Sync Twig templateExists behaviors
  Fix the :only-of-type pseudo class selector
  Deprecate the XmlEncoder::TYPE_CASE_ATTRIBUTES constant
  [Mailer] Tweak some code
  [Serializer] Add CsvEncoder tests for PHP 7.4
  Copy phpunit.xsd to a predictable path
  [WebserverBundle] Remove duplicated deprecation message
  remove duplicated test
  [Security/Http] fix parsing X509 emailAddress
  [FrameworkBundle] conflict with VarDumper < 4.4
  ...
2019-10-02 17:00:37 +02:00
Nicolas Grekas
c2111be180 feature #33775 [Console] Add deprecation message for non-int statusCode (jschaedl)
This PR was merged into the 4.4 branch.

Discussion
----------

[Console] Add deprecation message for non-int statusCode

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

### What was done:

- [x] added deprecation message for non-int return value in Command::execute()
- [x] fixed all core commands to return proper int values
- [x] added proper return type-hint to Command::execute() method in all core Commands

Commits
-------

98c4f6a06c [Console] Command::execute() should always return int - deprecate returning null
2019-10-02 16:45:52 +02:00
Jan Schädlich
98c4f6a06c [Console] Command::execute() should always return int - deprecate returning null
- added deprecation message for non-int return value in Command::execute()
- fixed all core commands to return proper int values
- added proper return type-hint to Command::execute() method in all core Commands
2019-10-02 16:44:58 +02:00
Nicolas Grekas
3354bacc02 Merge branch '4.3' into 4.4
* 4.3:
  [FrameworkBundle] Fix wrong returned status code in ConfigDebugCommand
  [AnnotationCacheWarmer] add RedirectController to annotation cache
  [DI] add tests loading calls with returns-clone
  [EventDispatcher] Added tests for aliased events.
  [DI] Add CSV env var processor tests
2019-10-02 16:41:32 +02:00
Nicolas Grekas
bf62544a0c Merge branch '3.4' into 4.3
* 3.4:
  [FrameworkBundle] Fix wrong returned status code in ConfigDebugCommand
  [AnnotationCacheWarmer] add RedirectController to annotation cache
2019-10-02 16:38:26 +02:00
Justin Reherman
64aecab0a7
Don't let falsey usernames slip through 2019-10-02 10:20:10 -04:00
Nicolas Grekas
1fea53330d bug #33744 [DI] Add CSV env var processor tests / support PHP 7.4 (ro0NL)
This PR was merged into the 4.3 branch.

Discussion
----------

[DI] Add CSV env var processor tests / support PHP 7.4

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #... <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Similar as #32051

Commits
-------

82f341864c [DI] Add CSV env var processor tests
2019-10-02 14:58:58 +02:00
Nicolas Grekas
69928be76e minor #33795 [EventDispatcher] Added tests for aliased events (derrabus)
This PR was merged into the 4.3 branch.

Discussion
----------

[EventDispatcher] Added tests for aliased events

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

While working on #33793 I discovered that I could remove the event alias feature of `RegisterListenersPass` without breaking the component's tests. This PR adds the missing tests.

Commits
-------

8e8a6ed99b [EventDispatcher] Added tests for aliased events.
2019-10-02 14:57:27 +02:00
Nicolas Grekas
badb656f62 minor #33801 [DI] add tests loading calls with returns-clone (nicolas-grekas)
This PR was merged into the 4.3 branch.

Discussion
----------

[DI] add tests loading calls with returns-clone

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

Commits
-------

9a48def0c0 [DI] add tests loading calls with returns-clone
2019-10-02 14:55:34 +02:00
Nicolas Grekas
00792fc778 minor #33788 [Serializer] Remove XmlEncoder::TYPE_CASE_ATTRIBUTES constant (pierredup)
This PR was merged into the 5.0-dev branch.

Discussion
----------

[Serializer] Remove XmlEncoder::TYPE_CASE_ATTRIBUTES constant

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | not really
| Deprecations? | yes (well, sort of)
| Tickets       | N/A
| License       | MIT
| Doc PR        | N/A

There is a small typo in the `XmlEncoder` constant. This can only be fixed in the master branch for Symfony 5 as it is a breaking change. I'm not sure if it's possible to deprecate the usage of the old constant name in 4.4? As the constant just resolves to a string, there is no way of determining if someone used the constant or not (a quick search on Github, I can't find any direct usages of the constant outside of this class)

Commits
-------

001d0f1693 Remove XmlEncoder::TYPE_CASE_ATTRIBUTES constant
2019-10-02 14:42:21 +02:00
Nicolas Grekas
4d6fe5ce5d feature #33783 [WebProfilerBundle] Try to display the most useful panel by default (fancyweb)
This PR was merged into the 4.4 branch.

Discussion
----------

[WebProfilerBundle] Try to display the most useful panel by default

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

Alternative to https://github.com/symfony/symfony/pull/32491, the goal stays the same.

I think reserving a data collector name is fine, isn'it ? It's not likely that end users use this name (that's why I added an underscore) + shouldn't be hard for them to just rename it.

I don't think adding a configuration option to toggle the "_best" behavior is useful, should be by default for DX IMHO.

Not adding an extension point for now (for end users to set their panel as the "best"), maybe later if someone request it?

Commits
-------

a45dd98b73 [WebProfilerBundle] Try to display the most useful panel by default
2019-10-02 14:22:29 +02:00
Christian Flothmann
fb5f8fb96a bug #33805 [FrameworkBundle] Fix wrong returned status code in ConfigDebugCommand (jschaedl)
This PR was merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle] Fix wrong returned status code in ConfigDebugCommand

| Q             | A
| ------------- | ---
| Branch?       | 3.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 #33747<!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | -

This is a follow-up PR caused by https://github.com/symfony/symfony/pull/33775#discussion_r330463216

Commits
-------

9b5ced20bb [FrameworkBundle] Fix wrong returned status code in ConfigDebugCommand
2019-10-02 14:13:41 +02:00
Nicolas Grekas
a176d1a928 bug #33807 [String] fix toAscii() (nicolas-grekas)
This PR was merged into the 5.0-dev branch.

Discussion
----------

[String] fix toAscii()

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

Commits
-------

46a23f87d9 [String] fix toAscii()
2019-10-02 14:13:38 +02:00
Nicolas Grekas
46a23f87d9 [String] fix toAscii() 2019-10-02 14:01:44 +02:00
Jan Schädlich
9b5ced20bb [FrameworkBundle] Fix wrong returned status code in ConfigDebugCommand 2019-10-02 12:47:49 +02:00
Nicolas Grekas
db9ef8ae17 bug #33781 [AnnotationCacheWarmer] add RedirectController to annotation cache (jenschude)
This PR was submitted for the 4.3 branch but it was merged into the 3.4 branch instead (closes #33781).

Discussion
----------

[AnnotationCacheWarmer] add RedirectController to annotation cache

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

This prevents to exclude the RedirectController from the warmed annotation cache which would lead to warnings when trying to use the warmed cache on read only file systems

Commits
-------

6b6c246c72 [AnnotationCacheWarmer] add RedirectController to annotation cache
2019-10-02 11:29:22 +02:00
Jens Schulze
6b6c246c72 [AnnotationCacheWarmer] add RedirectController to annotation cache
This prevents to exclude the RedirectController from the warmed annotation cache which would lead to warnings when trying to use the warmed cache on read only file systems

See #29357
2019-10-02 11:29:04 +02:00
Nicolas Grekas
e3aed1055d minor #33782 [DI] dont mandate a class on inline services with a factory (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[DI] dont mandate a class on inline services with a factory

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

This check is too strict, useless and boring for inline services :)

Commits
-------

a2665d17cd [DI] dont mandate a class on inline services with a factory
2019-10-02 11:23:07 +02:00
Nicolas Grekas
e04cf9155e minor #33803 [Serializer] Add note about deprecating the XmlEncoder::TYPE_CASE_ATTRIBUTES constant in upgrade (pierredup)
This PR was merged into the 4.4 branch.

Discussion
----------

[Serializer] Add note about deprecating the XmlEncoder::TYPE_CASE_ATTRIBUTES constant in upgrade

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | N/A
| New feature?  | N/A
| Deprecations? | N/A
| Tickets       | https://github.com/symfony/symfony/pull/33789#issuecomment-537392407
| License       | MIT
| Doc PR        | N/A

Commits
-------

b4de582c18 Add note about deprecating the XmlEncoder::TYPE_CASE_ATTRIBUTES constant in the upgrade guide
2019-10-02 11:19:55 +02:00
Pierre du Plessis
001d0f1693
Remove XmlEncoder::TYPE_CASE_ATTRIBUTES constant 2019-10-02 11:18:51 +02:00
Thomas Calvet
a45dd98b73 [WebProfilerBundle] Try to display the most useful panel by default 2019-10-02 11:17:11 +02:00
Nicolas Grekas
41e452a906 Merge branch '4.3' into 4.4
* 4.3:
  fix merge
2019-10-02 11:13:07 +02:00