Commit Graph

46057 Commits

Author SHA1 Message Date
Nicolas Grekas
36041a8858 minor #34307 [4.4] Disallow symfony/contracts v2 (derrabus)
This PR was merged into the 4.4 branch.

Discussion
----------

[4.4] Disallow symfony/contracts v2

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

Travis is red at the moment because unit tests on 4.4 are run against the incompatible event dispatcher contracts v2. https://travis-ci.org/symfony/symfony/jobs/609622341#L4719-L4725

~~This PR proposes to switch to individual packages, so we can specifically disallow those incompatible contracts.~~

This PR pins the `symfony/contracts` package to v1.1 on `symfony/symfony`.

Commits
-------

f2dc2d6d8b Disallow symfony/contracts v2.
2019-11-09 21:57:00 +01:00
Alexander M. Turek
f2dc2d6d8b Disallow symfony/contracts v2. 2019-11-09 20:42:39 +01:00
Robin Chalas
040d93d5b5 minor add missing loop break 2019-11-09 13:08:24 +01:00
Fabien Potencier
9aa7492fdc feature #33497 [Contracts] Add parameter type declarations to contracts (derrabus)
This PR was merged into the 5.0-dev branch.

Discussion
----------

[Contracts] Add parameter type declarations to contracts

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #32179
| License       | MIT
| Doc PR        | N/A

This PR proposes to create a php 7.2 version of the contracts that maintains BC with Symfony 4. The PR suggests to bump the contracts version to ~~1.2~~ 2.0 on the master branch. We would still be able to maintain the contracts 1.1 branch on Symfony's 4.4 branch, should we need to patch the current contracts in the future.

This move would allow us to add parameter type declarations to existing contracts interfaces and make use of them in Symfony 5. Especially the Translation and EventDispatcher components benefit a lot from this bump, imho.

Contracts that will be added on the road to Symfony 6 wouldn't be restricted to the capabilities of php 7.1, which would be another benefit in my opinion.

~~<sup>1</sup> Test currently fail because the translator is called with `null` as translation key. That possibility should be deprecated imho.~~

Commits
-------

4de3773979 Add parameter type declarations to contracts.
2019-11-09 12:23:17 +01:00
Fabien Potencier
758e266f48 bug #34304 [Security] Fix defining multiple roles per access_control rule (chalasr)
This PR was merged into the 4.4 branch.

Discussion
----------

[Security] Fix defining multiple roles per access_control rule

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        |  https://github.com/symfony/symfony-docs/pull/12371 needs to be reverted

#33584 deprecated passing multiple attributes to `AccessDecisionManager::decide()`, but this change must not impact `access_control` as you cannot define multiple rules with the same criteria for request matching (the first match wins).

Commits
-------

338b3dfd9f [Security] Fix defining multiple roles per access_control rule
2019-11-09 12:16:35 +01:00
Fabien Potencier
d688a79b5a feature #34139 [Security] Add migrating encoder configuration (chalasr)
This PR was merged into the 4.4 branch.

Discussion
----------

[Security] Add migrating encoder configuration

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

Commits
-------

80955be45d [Security] Add migrating encoder configuration
2019-11-09 12:12:07 +01:00
Robin Chalas
80955be45d [Security] Add migrating encoder configuration 2019-11-09 11:20:37 +01:00
Nicolas Grekas
69d436b93c Merge branch '4.4'
* 4.4:
  [Translator] fix compat with translation-contracts v2
2019-11-09 10:30:44 +01:00
Nicolas Grekas
12a8b6937b [Translator] fix compat with translation-contracts v2 2019-11-09 10:30:00 +01:00
Alexander M. Turek
4de3773979 Add parameter type declarations to contracts. 2019-11-09 10:18:34 +01:00
Nicolas Grekas
14dcefbc57 Merge branch '4.4'
* 4.4:
  [IdentityTranslator] fix compat with translation-contracts v2
2019-11-09 09:53:09 +01:00
Nicolas Grekas
55559f48b5 [IdentityTranslator] fix compat with translation-contracts v2 2019-11-09 09:49:52 +01:00
Robin Chalas
338b3dfd9f [Security] Fix defining multiple roles per access_control rule 2019-11-09 09:18:51 +01:00
Nicolas Grekas
2a1a266573 Merge branch '4.4'
* 4.4:
  [Messenger] Fixed bad event dispatcher mocks.
  [Workflow] Simplified EventDispatcherMock.
  [Routing] revert the return type for UrlGeneratorInterface::generate to remove null
  [HttpFoundation] Add a way to anonymize IPs
2019-11-09 09:06:17 +01:00
Nicolas Grekas
a20e1ad138 Merge branch '4.3' into 4.4
* 4.3:
  [Workflow] Simplified EventDispatcherMock.
  [Routing] revert the return type for UrlGeneratorInterface::generate to remove null
2019-11-09 09:06:11 +01:00
Nicolas Grekas
72166c439d Merge branch '3.4' into 4.3
* 3.4:
  [Routing] revert the return type for UrlGeneratorInterface::generate to remove null
2019-11-09 09:05:42 +01:00
Fabien Potencier
fd7c676172 minor #34303 [Messenger] Fixed bad event dispatcher mocks (derrabus)
This PR was merged into the 4.4 branch.

Discussion
----------

[Messenger] Fixed bad event dispatcher mocks

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

`EventDispatcherInterface::dispatch()` must return the passed event object. This PR fixes two mocks that violated this contract.

Commits
-------

103930039b [Messenger] Fixed bad event dispatcher mocks.
2019-11-09 07:45:24 +01:00
Fabien Potencier
4463791d0e minor #34299 [Routing] revert the return type for UrlGeneratorInterface::generate to remove null (shieldo)
This PR was merged into the 3.4 branch.

Discussion
----------

[Routing] revert the return type for UrlGeneratorInterface::generate to remove null

…to remove null

| Q             | A
| ------------- | ---
| Branch?       | 3.4 (only)
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| License       | MIT

Bit of a casualty of commit tennis this:

A change to add `null` here as an option for how `UrlGeneratorInterface::generate()` (rather than the concrete `UrlGenerator`) was merged in https://github.com/symfony/symfony/pull/28321, but then [reverted](90494c20cc) for the reason [that this could be seen as a BC break](https://github.com/symfony/symfony/pull/28321#issuecomment-418540080), as the `null` return had not previously been documented (and is still not as part of the interface method docs).

However, in a subsequent change (https://github.com/symfony/symfony/pull/33252) with a wider scope, this doc change was added _back_ in order to reflect the underlying implementation as a result of a PHPStorm plugin complaining. There's no indication though of what a `null` return here though would mean, and for the same reason as the first revert (that this should be seen as a BC break), I'd like to submit this to be reverted for the 3.4 branch. (In 4.4 the `null` has already been removed.)

Having the interface indicating that this method can return `null` necessitates introducing a lot of actually redundant null checks in code that is covered by static analysis tools such as PHPStan.

Commits
-------

9f853f324f [Routing] revert the return type for UrlGeneratorInterface::generate to remove null
2019-11-09 07:39:26 +01:00
Fabien Potencier
e4ddc75549 minor #34302 [Workflow] Simplified EventDispatcherMock (derrabus)
This PR was merged into the 4.3 branch.

Discussion
----------

[Workflow] Simplified EventDispatcherMock

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

This PR simplifies the Workflow component's mock implementation of the event dispatcher by implementing the much simpler contracts interface instead of the full-blown component interface.

Commits
-------

5aee181c83 [Workflow] Simplified EventDispatcherMock.
2019-11-09 07:38:43 +01:00
Fabien Potencier
f4c925418b feature #32194 [HttpFoundation] Add a way to anonymize IPs (Seldaek)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpFoundation] Add a way to anonymize IPs

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features --> TODO

This is helpful for GDPR compliance reasons, and it isn't much code saved but it's also good if you don't have to think about how to do it.

Commits
-------

9e62330bc4 [HttpFoundation] Add a way to anonymize IPs
2019-11-09 07:36:01 +01:00
Wouter J
e41e6b48a9 Clarified single attribute to isGranted() a bit more
Also, allow the array type for a single attribute.
2019-11-09 00:23:23 +01:00
Alexander M. Turek
103930039b [Messenger] Fixed bad event dispatcher mocks. 2019-11-09 00:05:14 +01:00
Nicolas Grekas
c187fde429 Merge branch '4.4'
* 4.4:
  [EventDispatcher] dont allow event-dispatcher-contracts ^2
  [FrameworkBundle] fix lower dep
2019-11-08 23:41:40 +01:00
Nicolas Grekas
9e554cee75 [EventDispatcher] dont allow event-dispatcher-contracts ^2 2019-11-08 23:40:51 +01:00
Alexander M. Turek
5aee181c83 [Workflow] Simplified EventDispatcherMock. 2019-11-08 23:25:20 +01:00
Nicolas Grekas
a676feb66b Merge branch '4.3' into 4.4
* 4.3:
  [FrameworkBundle] fix lower dep
2019-11-08 23:05:22 +01:00
Nicolas Grekas
b148114116 [FrameworkBundle] fix lower dep 2019-11-08 23:04:53 +01:00
Nicolas Grekas
69cd75069a Merge branch '4.4'
* 4.4:
  [DI] fix loading env while env loaders are loaded
2019-11-08 22:16:29 +01:00
Nicolas Grekas
26f25ab2b5 bug #34301 [DI] fix loading env while env loaders are loaded (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[DI] fix loading env while env loaders are loaded

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

Commits
-------

522bd5d99d [DI] fix loading env while env loaders are loaded
2019-11-08 22:16:14 +01:00
Nicolas Grekas
522bd5d99d [DI] fix loading env while env loaders are loaded 2019-11-08 21:45:30 +01:00
Douglas Greenshields
9f853f324f
[Routing] revert the return type for UrlGeneratorInterface::generate to remove null 2019-11-08 17:25:00 +00:00
Jordi Boggiano
9e62330bc4
[HttpFoundation] Add a way to anonymize IPs 2019-11-08 18:11:01 +01:00
Nicolas Grekas
0cd837bf1a Merge branch '4.4'
* 4.4:
  [DI] fix locators with numeric keys
  Add support for NO_COLOR env var
  [DI][FrameworkBundle] add EnvVarLoaderInterface - remove SecretEnvVarProcessor
  Fix error when we use VO for the marking property
  [DI] Remove LazyString from 4.4, before adding back to the String component
2019-11-08 17:32:03 +01:00
Nicolas Grekas
7c111bdcf3 minor #34290 [DI] Remove LazyString from 4.4, before adding back to the String component (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[DI] Remove LazyString from 4.4, before adding back to the String component

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

In #34190 I'm proposing to move LazyString to the Service contracts, but String might be a better fit actually. Let's remove the class from 4.4 where it's not really needed, and add it back on 5.0 in the String component.

Commits
-------

b1a3ee76ac [DI] Remove LazyString from 4.4, before adding back to the String component
2019-11-08 17:26:52 +01:00
Nicolas Grekas
f459fd01a2 Merge branch '4.3' into 4.4
* 4.3:
  [DI] fix locators with numeric keys
  Fix error when we use VO for the marking property
2019-11-08 17:24:33 +01:00
Nicolas Grekas
bc726f7d50 bug #34294 [Workflow] Fix error when we use ValueObject for the marking property (FabienSalles)
This PR was merged into the 4.3 branch.

Discussion
----------

[Workflow] Fix error when we use ValueObject for the marking property

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

Fix Illegal offset type in `MethodMarkingStore` class when we use Value Object for
the marking property.

Now, we can avoid to use only a string an we can have a Subject class with a Value Object like this :
```php
final class State
{
    public const DRAFT = 'draft';
    public const REVIEWED = 'reviewed';
    public const REJECTED = 'rejected';
    public const PUBLISHED = 'published';

     /** @var string */
    private $state;

    public function __construct(string $state)
    {
        // some validation
        $this->state = $state;
    }

    public function __toString()
     {
         return $this->state;
    }

    public static function Draft()
     {
         return new self(self::DRAFT);
     }
    ...
}

final class Subject
{
    private $marking;

    public function __construct(State $marking = null)
    {
        $this->marking = $marking;
    }

    public function getMarking()
    {
        return $this->marking;
    }

    public function setMarking($marking)
    {
        $this->marking = $marking instanceof State ? $marking : new State($marking);
    }

```

Commits
-------

6570d5cbe2 Fix error when we use VO for the marking property
2019-11-08 17:23:33 +01:00
Nicolas Grekas
618aec6abe Merge branch '3.4' into 4.3
* 3.4:
  [DI] fix locators with numeric keys
2019-11-08 17:22:27 +01:00
Nicolas Grekas
98e9fc8aee bug #34297 [DI] fix locators with numeric keys (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[DI] fix locators with numeric keys

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

Commits
-------

dad4344793 [DI] fix locators with numeric keys
2019-11-08 17:22:08 +01:00
Nicolas Grekas
dad4344793 [DI] fix locators with numeric keys 2019-11-08 17:18:30 +01:00
Nicolas Grekas
97577aea66 feature #34252 [Console] Add support for NO_COLOR env var (Seldaek)
This PR was merged into the 4.4 branch.

Discussion
----------

[Console] Add support for NO_COLOR env var

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

Adds support for https://no-color.org/ - ideally this would be considered a bugfix and added to older releases IMO, but submitting as new feature for now.

cc @johnstevenson

Commits
-------

c1b0a8e956 Add support for NO_COLOR env var
2019-11-08 17:06:42 +01:00
Jordi Boggiano
c1b0a8e956
Add support for NO_COLOR env var 2019-11-08 16:59:14 +01:00
Nicolas Grekas
57e9b81657 feature #34295 [DI][FrameworkBundle] add EnvVarLoaderInterface - remove SecretEnvVarProcessor (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[DI][FrameworkBundle] add EnvVarLoaderInterface - remove SecretEnvVarProcessor

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

This PR allows encrypting any env vars - not only those using the `%env(secret:<...>)%` processor (and the processor is removed actually).

It does so by introducing a new `EnvVarLoaderInterface` (and a corresponding `container.env_var_loader` tag), which are objects that should return a list of key/value pairs that will be accessible via the regular `%env(FOO)%` syntax.

The PR fixes a few issues found meanwhile. One is especially important: files in the vault should end with `.php` to protect against inadvertant exposures of the document root.

Commits
-------

ba2148fff3 [DI][FrameworkBundle] add EnvVarLoaderInterface - remove SecretEnvVarProcessor
2019-11-08 16:58:24 +01:00
Nicolas Grekas
ba2148fff3 [DI][FrameworkBundle] add EnvVarLoaderInterface - remove SecretEnvVarProcessor 2019-11-08 15:47:02 +01:00
FabienSalles
6570d5cbe2 Fix error when we use VO for the marking property
Fix Illegal offset type when we use ValueObject instead of string for
the marking property #28203 #22031
2019-11-08 12:45:38 +01:00
Nicolas Grekas
b1a3ee76ac [DI] Remove LazyString from 4.4, before adding back to the String component 2019-11-08 11:42:01 +01:00
Nicolas Grekas
38f86e6758 [DI] fix merge 2019-11-08 10:32:27 +01:00
Nicolas Grekas
c4226e4128 Merge branch '4.4'
* 4.4:
  [DI] Dont cache classes with missing parents
  [HttpClient] Fix a crash when calling CurlHttpClient::__destruct()
  Unallow symfony/http-kernel ^5.0
  [FrameworkBundle] fix SodiumVault after stof review
  [HttpClient] allow arbitrary JSON values in requests
  [DependencyInjection] Added option `ignore_errors: not_found` while importing config files
  [Validator] Add the missing translations for the Hebrew (\"he\") locale and fix 2 typos
  [FrameworkBundle][Translation] Invalidate cached catalogues when the scanned directories change
2019-11-08 10:16:28 +01:00
Nicolas Grekas
4cc88b1ce1 minor #34265 Remove \Throwable bubbling down support deprecation layer (fancyweb)
This PR was merged into the 5.0-dev branch.

Discussion
----------

Remove \Throwable bubbling down support deprecation layer

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

Remove deprecation layer of https://github.com/symfony/symfony/pull/33065

Commits
-------

ffcfdb42a7 Remove \Throwable support deprecation layer
2019-11-08 10:01:31 +01:00
Thomas Calvet
ffcfdb42a7 Remove \Throwable support deprecation layer 2019-11-08 10:00:49 +01:00
Nicolas Grekas
0628892c21 minor #34284 [ErrorHandler] Remove Symfony ClassLoader support in an error enhancer (fancyweb)
This PR was merged into the 5.0-dev branch.

Discussion
----------

[ErrorHandler] Remove Symfony ClassLoader support in an error enhancer

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/pull/33053#discussion_r322706127
| License       | MIT
| Doc PR        | -

Throwing a deprecation for this on 4.4 looks useless to me as the component was deprecated 2 years ago and stopping its support will not break anything.

Commits
-------

e7456547bd [ErrorHandler] Remove Symfony ClassLoader support in an error enhancer
2019-11-08 09:55:23 +01:00