Commit Graph

40977 Commits

Author SHA1 Message Date
Fabien Potencier cfc8ac02b3 bug #32071 Fix expired lock not cleaned (jderusse)
This PR was merged into the 3.4 branch.

Discussion
----------

Fix expired lock not cleaned

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #31426
| License       | MIT
| Doc PR        | NA

When a lock is acquired BUT not as fast as expected, a LockExpiredException is thrown.
Issue is, that the lock is not removed which avoid other process to acquire that lock.

This PR clean state of store when a LockExpiredException is triggered.

note: same bug should be fixed in 4.3 in PDO and Zookeeper

Commits
-------

9f960f34e7 Fix expired lock not cleaned
2019-06-17 18:47:35 +02:00
Jérémy Derussé 9f960f34e7
Fix expired lock not cleaned 2019-06-17 16:13:35 +02:00
Fabien Potencier a8520ae605 bug #32057 [HttpFoundation] Fix SA/phpdoc JsonResponse (ro0NL)
This PR was squashed before being merged into the 3.4 branch (closes #32057).

Discussion
----------

[HttpFoundation] Fix SA/phpdoc JsonResponse

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Commits
-------

270f10cc81 [HttpFoundation] Fix SA/phpdoc JsonResponse
2019-06-16 13:18:13 +02:00
Roland Franssen 270f10cc81 [HttpFoundation] Fix SA/phpdoc JsonResponse 2019-06-16 13:18:06 +02:00
Maxime Steinhausser c7cc780373 [FrameworkBundle] Unconditionally register the DateIntervalNormalizer 2019-06-14 15:17:07 +02:00
Fabien Potencier cfbb5b50b1 bug #32025 SimpleCacheAdapter fails to cache any item if a namespace is used (moufmouf)
This PR was squashed before being merged into the 3.4 branch (closes #32025).

Discussion
----------

SimpleCacheAdapter fails to cache any item if a namespace is used

| Q             | A
| ------------- | ---
| Branch?       |3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

This is a backport of #32019

The SimpleCacheAdapter extends AdapterTestCase.
When adding a namespace, the AdapterTestCase adds ":" after the namespace:

https://github.com/symfony/symfony/blob/v4.3.1/src/Symfony/Component/Cache/Adapter/AbstractAdapter.php#L37

The namespace is prepended to the cache key.
But in PSR-16, the ":" is a forbidden character.

As a result, the cache key is invalid and cache is not persisted. If you use Psr16Adapter + a namespace, the cache simply does not work.

As per @nicolas-grekas advices, a NS_SEPARATOR const is added to change the namespace separator for the `SimpleCacheAdapter` to "_" (that is compatible with PSR-16).

The first commit of this PR starts with an additional test and no fix (to showcase the problem).

Commits
-------

ffd3469ddf SimpleCacheAdapter fails to cache any item if a namespace is used
2019-06-14 13:16:09 +02:00
David Négrier ffd3469ddf SimpleCacheAdapter fails to cache any item if a namespace is used 2019-06-14 13:16:02 +02:00
Fabien Potencier 575e922964 bug #32037 [Form] validate composite constraints in all groups (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Form] validate composite constraints in all groups

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

Commits
-------

94ded00216 validate composite constraints in all groups
2019-06-14 09:55:42 +02:00
Christian Flothmann 94ded00216 validate composite constraints in all groups 2019-06-14 09:34:46 +02:00
Fabien Potencier b8978bd9ff bug #32007 [Serializer] Handle true and false appropriately in CSV encoder (battye)
This PR was squashed before being merged into the 3.4 branch (closes #32007).

Discussion
----------

[Serializer] Handle true and false appropriately in CSV encoder

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

Previously, if `true` was passed in as a value to the CSV encoder then `fputcsv()` would correctly treat it as 1. However, if `false` was passed in, it would be treated as a blank value. `null` would also be treated as a blank value.

This fix makes it consistent so that true and false will map to 1 and 0, while null maps to an empty string.

Commits
-------

89cba00c68 [Serializer] Handle true and false appropriately in CSV encoder
2019-06-14 07:50:06 +02:00
battye 89cba00c68 [Serializer] Handle true and false appropriately in CSV encoder 2019-06-14 07:49:57 +02:00
Fabien Potencier bd9d0a4793 bug #32000 [Routing] fix absolute url generation when scheme is not known (Tobion)
This PR was merged into the 3.4 branch.

Discussion
----------

[Routing] fix absolute url generation when scheme is not known

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #25491
| License       | MIT
| Doc PR        |

This fixes two edge cases in the url generator:
1. when the context scheme is not known (empty) generating an absolute url would return an invalid url starting with `://host/path`. #25491 handled the case when the host is unknown which makes sense. but the way it was done, created this new problem.
2. non-http(s) urls do not require a host. e.g. typical `file:///path` urls. url generator is fixed to be in line with rfc3986

Commits
-------

8e04222976 [Routing] fix absolute url generation when scheme is not known
2019-06-13 18:44:13 +02:00
Fabien Potencier faf7b305f9 bug #32024 [VarDumper] fix dumping objects that implement __debugInfo() (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[VarDumper] fix dumping objects that implement __debugInfo()

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Right now it fails if the return value is not an array + it doesn't dump the original details from the object's internals.

Commits
-------

a9d0038ec0 [VarDumper] fix dumping objects that implement __debugInfo()
2019-06-13 18:26:35 +02:00
Fabien Potencier 27316a4206 minor #32006 Fix binary operation `+`, `-` or `*` on string by type casting to integer (steef)
This PR was submitted for the 4.3 branch but it was merged into the 3.4 branch instead (closes #32006).

Discussion
----------

Fix binary operation `+`, `-` or `*` on string by type casting to integer

| Q             | A
| ------------- | ---
| Branch?       | 4.3 for bug fixes <!-- see below -->
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT

# Description
After playing around with [PHPStan](https://github.com/phpstan/phpstan) I found potential improvements when we try to add, subtract or multiply on a string by type casting these values to integers. PHPStan has 8 different [levels](https://github.com/phpstan/phpstan#rule-levels) of strictness and these errors come up after level 2.

## Screenshot example
### Old ️
<img width="876" alt="Screenshot 2019-06-12 at 11 49 22" src="https://user-images.githubusercontent.com/34915382/59435551-2bea0280-8dee-11e9-8eb2-954d34973382.png">

### New 
<img width="876" alt="Screenshot 2019-06-12 at 11 48 54" src="https://user-images.githubusercontent.com/34915382/59435562-30aeb680-8dee-11e9-806d-d37985096363.png">

## How to test
1. Require PHPStan in [Composer](https://getcomposer.org/):
```
composer require --dev phpstan/phpstan
```
2. Create the following `phpstan.neon` [config](https://github.com/phpstan/phpstan#configuration) file:
```
parameters:
    excludes_analyse:
        - 'src/Symfony/Component/Form/Tests'
        - 'src/Symfony/Component/Cache/Tests'
        - 'src/Symfony/Component/DomCrawler/Tests'
        - 'src/Symfony/Component/HttpKernel/Tests'
        - 'src/Symfony/Component/PropertyAccess/Tests'
        - 'src/Symfony/Component/Routing/Tests'
        - 'src/Symfony/Component/Validator/Tests'
        - 'src/Symfony/Component/HttpKernel/Tests'
```
3. Comment out line 202-204 of the following file:
```
src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php
```
4. Analyse the project and search for binary operation errors by running:
```
vendor/bin/phpstan analyse src --level 2 -c phpstan.neon | grep --context=5 "Binary operation"
```
> Keep in mind that four errors will still popup. Three are for `+=` or `+` on arrays and the other one is  about `.` between an interface and empty array which in my opinion can't be improved.

Commits
-------

d445465ef4 Fix binary operation `+`, `-` or `*` on string
2019-06-13 17:39:38 +02:00
Stefano Degenkamp d445465ef4 Fix binary operation `+`, `-` or `*` on string
By type casting to integer.
2019-06-13 17:39:17 +02:00
Nicolas Grekas a9d0038ec0 [VarDumper] fix dumping objects that implement __debugInfo() 2019-06-13 14:39:23 +02:00
Fabien Potencier 37fa45bbd1 fixed CS 2019-06-13 12:57:15 +02:00
Fabien Potencier 0f958aabfa Merge branch '3.4' into 4.2
* 3.4:
  fixed CS
  [HttpKernel] Remove TestEventDispatcher.
2019-06-13 12:50:42 +02:00
Fabien Potencier a0b6d3de65 minor #32020 CS fixes native functions (fabpot)
This PR was merged into the 3.4 branch.

Discussion
----------

CS fixes native functions

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

<!--
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):
 - 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.
-->

Commits
-------

106b348d3d fixed CS
2019-06-13 12:42:06 +02:00
Fabien Potencier 106b348d3d fixed CS 2019-06-13 12:34:15 +02:00
Tomas a9705a0143 Fix AuthenticationException::getToken typehint 2019-06-12 07:10:29 +03:00
Tobias Schultze 8e04222976 [Routing] fix absolute url generation when scheme is not known 2019-06-12 03:24:15 +02:00
Fabien Potencier 7a6ce5ff85 minor #31994 [HttpKernel] Remove TestEventDispatcher (derrabus)
This PR was merged into the 3.4 branch.

Discussion
----------

[HttpKernel] Remove TestEventDispatcher

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

This class seems to be an orphaned test fixture. Let's delete it.

Commits
-------

48be09f37e [HttpKernel] Remove TestEventDispatcher.
2019-06-11 21:38:58 +02:00
Nicolas Grekas b856ab5aa2 Merge branch '3.4' into 4.2
* 3.4:
  [WebProfilerBundle] fix FC with HttpFoundation v5
  [Form] test case is not legacy
  Fix reporting unsilenced deprecations from insulated tests
  Added FormInterface to @return Form::getClickedButton docblock
2019-06-11 17:21:32 +02:00
Alexander M. Turek 48be09f37e [HttpKernel] Remove TestEventDispatcher. 2019-06-11 12:48:01 +02:00
Christian Flothmann 776ab628f6 minor #31963 [Form] test case is not legacy (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[Form] test case is not legacy

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

At least it's green.
/cc @xabbuh @HeahDude

Commits
-------

9ad324ba29 [Form] test case is not legacy
2019-06-11 09:20:04 +02:00
Alexandre Segura ff5517e554 Add missing rendering of form help block. 2019-06-10 10:21:04 +02:00
Nicolas Grekas 1872a5af39 [WebProfilerBundle] fix FC with HttpFoundation v5 2019-06-09 18:36:33 +02:00
Nicolas Grekas a1d07a99cd bug #31962 Fix reporting unsilenced deprecations from insulated tests (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

Fix reporting unsilenced deprecations from insulated tests

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Introduced while fixing CS in batch.

Commits
-------

48093f4a13 Fix reporting unsilenced deprecations from insulated tests
2019-06-09 18:16:23 +02:00
Nicolas Grekas 9025ded97a minor #31950 [OptionsResolver] fix adding $triggerDeprecation to Options::offsetGet() (nicolas-grekas)
This PR was submitted for the 4.3 branch but it was merged into the 4.2 branch instead (closes #31950).

Discussion
----------

[OptionsResolver] fix adding $triggerDeprecation to Options::offsetGet()

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

This has been added by @yceruto in #28878 but it doesn't make sense to me: the interface has no concept if deprecation (`OptionsResolver` has!)

Commits
-------

adc7e6ab7c [OptionsResolver] fix adding $triggerDeprecation to Options::offsetGet()
2019-06-09 18:15:11 +02:00
Nicolas Grekas adc7e6ab7c [OptionsResolver] fix adding $triggerDeprecation to Options::offsetGet() 2019-06-09 18:15:03 +02:00
Nicolas Grekas 9ad324ba29 [Form] test case is not legacy 2019-06-09 16:44:28 +02:00
Nicolas Grekas 48093f4a13 Fix reporting unsilenced deprecations from insulated tests 2019-06-09 16:27:26 +02:00
Christian Flothmann db91042f6b minor #31222 [Form] Add Button type back to Form::getClickedButton docblock (Bill Hance)
This PR was merged into the 3.4 branch.

Discussion
----------

[Form] Add Button type back to Form::getClickedButton docblock

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

In commit 56429a6f08 the `Button` type was removed from the return doc block.

I suspect this was an oversight because, AFAIK, the [recommended way](https://symfony.com/doc/current/form/multiple_buttons.html) to check the name of a clicked button would require a return type of `Button` or `SubmitButton`.

The effect is that our static analysis checks are failing.
```
Call to an undefined method
Symfony\Component\Form\ClickableInterface::getName().
```

Commits
-------

b71d589071 Added FormInterface to @return Form::getClickedButton docblock
2019-06-08 11:35:31 +02:00
Nicolas Grekas 13e5773132 minor #31944 [DI] Fix suspicious test (ro0NL)
This PR was merged into the 4.2 branch.

Discussion
----------

[DI] Fix suspicious test

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #31942
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

cc @nicolas-grekas

Commits
-------

25b961aadc [DI] Fix suspicious test
2019-06-08 08:03:01 +02:00
Roland Franssen 25b961aadc [DI] Fix suspicious test 2019-06-08 08:01:32 +02:00
Nicolas Grekas e2660e0a0e Merge branch '3.4' into 4.2
* 3.4:
  [SecurityBundle] add missing contraint for symfony/config dep
2019-06-07 22:41:35 +02:00
Nicolas Grekas 07ca9f4831 [SecurityBundle] add missing contraint for symfony/config dep 2019-06-07 22:39:07 +02:00
Nicolas Grekas f3f7721dcb Merge branch '3.4' into 4.2
* 3.4:
  [travis] increase concurrency
2019-06-07 20:25:08 +02:00
Nicolas Grekas 5238826912 minor #31939 [travis] increase concurrency (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[travis] increase concurrency

just a try to see if this makes the CI faster

Commits
-------

5e1ffb8d7f [travis] increase concurrency
2019-06-07 20:17:32 +02:00
Nicolas Grekas 5e1ffb8d7f [travis] increase concurrency 2019-06-07 19:50:04 +02:00
Nicolas Grekas 7054a385b9 minor #31933 [DependencyInjection] fix the ValidateEnvPlaceHolderPassTest that was using a deprecated path for TreeBuilder (Simperfit)
This PR was merged into the 4.2 branch.

Discussion
----------

[DependencyInjection] fix the ValidateEnvPlaceHolderPassTest that was using a deprecated path for TreeBuilder

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | none   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | none <!-- required for new features -->

<!--
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):
 - 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.
-->

This should be fixed in 4.2 because the deprecation has been introduced in 4.2 as said by @stof in https://github.com/symfony/symfony/pull/31932/files#r291600094

Commits
-------

caabd92f89 [DependencyInjection] fix the ValidateEnvPlaceHolderPassTest that was using a deprecated path for TreeBuilder
2019-06-07 16:24:06 +02:00
Amrouche Hamza caabd92f89
[DependencyInjection] fix the ValidateEnvPlaceHolderPassTest that was using a deprecated path for TreeBuilder 2019-06-07 16:04:41 +02:00
Nicolas Grekas 0364135989 bug #31925 [Form] fix usage of legacy TranslatorInterface (nicolas-grekas)
This PR was merged into the 4.2 branch.

Discussion
----------

[Form] fix usage of legacy TranslatorInterface

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Commits
-------

0fbfefe869 [Form] fix usage of legacy TranslatorInterface
2019-06-07 15:57:04 +02:00
Nicolas Grekas 51299b4472 Merge branch '3.4' into 4.2
* 3.4:
  [Serializer] Fix DataUriNormalizer docblock & composer suggest section
2019-06-07 15:56:41 +02:00
Nicolas Grekas 50b3ba9457 minor #31922 [Serializer] Fix DataUriNormalizer docblock & composer suggest section (ogizanagi)
This PR was merged into the 3.4 branch.

Discussion
----------

[Serializer] Fix DataUriNormalizer docblock & composer suggest section

| Q             | A
| ------------- | ---
| Branch?       | 3.4  <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | yes/no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | N/A   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

See
9691519ca4/src/Symfony/Component/Serializer/Normalizer/DataUriNormalizer.php (L135-L139)

Commits
-------

51b6bd886a [Serializer] Fix DataUriNormalizer docblock & composer suggest section
2019-06-07 15:54:35 +02:00
Nicolas Grekas 0fbfefe869 [Form] fix usage of legacy TranslatorInterface 2019-06-07 11:33:39 +02:00
Maxime Steinhausser 51b6bd886a [Serializer] Fix DataUriNormalizer docblock & composer suggest section 2019-06-07 10:45:31 +02:00
Nicolas Grekas d98dd9bd82 bug #31908 [Validator] fix deprecation layer of ValidatorBuilder (nicolas-grekas)
This PR was merged into the 4.2 branch.

Discussion
----------

[Validator] fix deprecation layer of ValidatorBuilder

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

As identified in https://github.com/symfony/symfony/pull/31898: we cannot remove the interface and make the replacing implementation final in the same run. This PR turns only setTranslator() final to allow changing its type hint in 5.0.

Commits
-------

154ce81519 [Validator] fix deprecation layer of ValidatorBuilder
2019-06-06 20:29:27 +02:00
Nicolas Grekas 154ce81519 [Validator] fix deprecation layer of ValidatorBuilder 2019-06-06 19:07:55 +02:00