Commit Graph

42774 Commits

Author SHA1 Message Date
Nicolas Grekas
fa29a56683 Merge branch '4.4'
* 4.4:
  [Cache] replace getNsSeparator by NS_SEPARATOR on AbstractTrait
  [Cache] fix versioning with SimpleCacheAdapter
  [Messenger] fix AMQP delay queue to be per exchange
  Fix expired lock not cleaned
  Fine tune constructor types
  [HttpClient] throw DecodingExceptionInterface when toArray() fails because of content-type error
  [HttpFoundation] Fix SA/phpdoc JsonResponse
  [DI] Show the right class autowired when providing a non-existing class in constructor
  SimpleCacheAdapter fails to cache any item if a namespace is used
  validate composite constraints in all groups
  [Serializer] Handle true and false appropriately in CSV encoder
  [Messenger] improve logs
  [Messenger] fix delay delivery for non-fanout exchanges
  Parameterize Mailgun's region
  Fix binary operation `+`, `-` or `*` on string
  [VarDumper] fix dumping objects that implement __debugInfo()
  [HttpClient] Don't use CurlHttpClient on Windows when curl.cainfo is not set
  Add statement to fileLink to ignore href code when no fileLink.
  [Routing] fix absolute url generation when scheme is not known
2019-06-17 19:43:54 +02:00
Nicolas Grekas
651de173df Merge branch '4.3' into 4.4
* 4.3:
  [Cache] replace getNsSeparator by NS_SEPARATOR on AbstractTrait
  [Cache] fix versioning with SimpleCacheAdapter
  [Messenger] fix AMQP delay queue to be per exchange
  Fix expired lock not cleaned
  [HttpClient] throw DecodingExceptionInterface when toArray() fails because of content-type error
  [HttpFoundation] Fix SA/phpdoc JsonResponse
  [DI] Show the right class autowired when providing a non-existing class in constructor
  SimpleCacheAdapter fails to cache any item if a namespace is used
  validate composite constraints in all groups
  [Serializer] Handle true and false appropriately in CSV encoder
  [Messenger] improve logs
  [Messenger] fix delay delivery for non-fanout exchanges
  Parameterize Mailgun's region
  Fix binary operation `+`, `-` or `*` on string
  [VarDumper] fix dumping objects that implement __debugInfo()
  [HttpClient] Don't use CurlHttpClient on Windows when curl.cainfo is not set
  Add statement to fileLink to ignore href code when no fileLink.
  [Routing] fix absolute url generation when scheme is not known
2019-06-17 19:38:10 +02:00
Nicolas Grekas
953ac3e77f Merge branch '4.2' into 4.3
* 4.2:
  [Cache] replace getNsSeparator by NS_SEPARATOR on AbstractTrait
  [Cache] fix versioning with SimpleCacheAdapter
  Fix expired lock not cleaned
  [HttpFoundation] Fix SA/phpdoc JsonResponse
  SimpleCacheAdapter fails to cache any item if a namespace is used
  validate composite constraints in all groups
  [Serializer] Handle true and false appropriately in CSV encoder
  Fix binary operation `+`, `-` or `*` on string
  [VarDumper] fix dumping objects that implement __debugInfo()
  [Routing] fix absolute url generation when scheme is not known
2019-06-17 19:37:00 +02:00
Nicolas Grekas
6b61439fb9 Merge branch '3.4' into 4.2
* 3.4:
  [Cache] replace getNsSeparator by NS_SEPARATOR on AbstractTrait
  [Cache] fix versioning with SimpleCacheAdapter
2019-06-17 19:31:01 +02:00
Nicolas Grekas
2bf5da51da [Cache] replace getNsSeparator by NS_SEPARATOR on AbstractTrait 2019-06-17 19:26:15 +02:00
Nicolas Grekas
02a6f248b5 [Cache] fix versioning with SimpleCacheAdapter 2019-06-17 19:18:24 +02:00
Nicolas Grekas
06c17cdaa9 Merge branch '3.4' into 4.2
* 3.4:
  Fix expired lock not cleaned
  [HttpFoundation] Fix SA/phpdoc JsonResponse
  SimpleCacheAdapter fails to cache any item if a namespace is used
  validate composite constraints in all groups
  [Serializer] Handle true and false appropriately in CSV encoder
  Fix binary operation `+`, `-` or `*` on string
  [VarDumper] fix dumping objects that implement __debugInfo()
  [Routing] fix absolute url generation when scheme is not known
2019-06-17 19:15:38 +02:00
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
Fabien Potencier
12b852f7ab bug #32052 [Messenger] fix AMQP delay queue to be per exchange (Tobion)
This PR was squashed before being merged into the 4.3 branch (closes #32052).

Discussion
----------

[Messenger] fix AMQP delay queue to be per exchange

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| 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 | #32050
| License       | MIT
| Doc PR        |

this makes the delay/retry work when having several exchanges or renaming your exchange.

also the delay setup did not declare the target exchange. so if you only do delayed messages for a connection, auto-setup forgot to actually create the target exchange.

Commits
-------

5bc3364167 [Messenger] fix AMQP delay queue to be per exchange
2019-06-17 18:44:05 +02:00
Tobias Schultze
5bc3364167 [Messenger] fix AMQP delay queue to be per exchange 2019-06-17 18:43:56 +02:00
Fabien Potencier
6ee3efac79 minor #32066 Fine tune constructor types (Tobion)
This PR was merged into the 4.4 branch.

Discussion
----------

Fine tune constructor types

| Q             | A
| ------------- | ---
| Branch?       | 4.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 |
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Fine tunes some constructor types that have been added in #24722

Form names as integer was only a workaround as forms names are used as array keys which get transformed to int. So it was added as a workaround in https://github.com/symfony/symfony/pull/6355#discussion_r2422205
With typehints added in #24722 those were mostly auto-cast anyway, e.g. in FormBuilder. There are only a few integer form names remaining documented, in the main entry points of the Form component (`\Symfony\Component\Form\FormInterface::add`). Internally it's always a string now. So I could remove some int docs which also fixes #30032 what @xabbuh tried to do.

Some of these changes we're just not done before because of broken tests. It's mainly a missing explicit mock for `TranslationInterface::trans` which returned null. If we had return types hints in interfaces, this wouldn't happen.

Commits
-------

507794a575 Fine tune constructor types
2019-06-17 18:40:55 +02:00
Fabien Potencier
99c44a3836 bug #32065 [HttpClient] throw DecodingExceptionInterface when toArray() fails because of content-type error (nicolas-grekas)
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] throw DecodingExceptionInterface when toArray() fails because of content-type error

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

As spotted in the linked issue, we are missing this type of exception. It's a bug at the contracts level.

Commits
-------

3f167417fb [HttpClient] throw DecodingExceptionInterface when toArray() fails because of content-type error
2019-06-17 18:35:34 +02:00
Jérémy Derussé
9f960f34e7
Fix expired lock not cleaned 2019-06-17 16:13:35 +02:00
Nicolas Grekas
ac7d168ffa Merge branch '4.4'
* 4.4:
  [PhpUnitBridge] Bump PHPUnit 7+8
  Prepare for PHP 7.4 preload
  prevent double deprecation message
  [Validator] Deprecate unused arg in ExpressionValidator
  [Config] Introduce find method in ArrayNodeDefinition to ease configuration tree manipulation
  [DomCrawler][Feature][DX] Add Form::getName() method
  [VarDumper] caster for HttpClient's response dumps all info
2019-06-17 13:53:04 +02:00
Nicolas Grekas
a0aa94114a minor #32054 Prepare for PHP 7.4 preload (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

Prepare for PHP 7.4 preload

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

PHP 7.4 preloading is not compatible with declaring the same class twice in if/else blocks.
Let's split the ones we have in several files.

Commits
-------

7cf3fb4a21 Prepare for PHP 7.4 preload
2019-06-17 13:50:38 +02:00
Tobias Schultze
507794a575 Fine tune constructor types 2019-06-17 02:42:58 +01:00
Nicolas Grekas
3f167417fb [HttpClient] throw DecodingExceptionInterface when toArray() fails because of content-type error 2019-06-16 20:17:37 +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
Fabien Potencier
8496003634 feature #32059 [PhpUnitBridge] Bump PHPUnit 7+8 (ro0NL)
This PR was squashed before being merged into the 4.4 branch (closes #32059).

Discussion
----------

[PhpUnitBridge] Bump PHPUnit 7+8

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| 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 -->

<!--
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
-------

5491d5347c [PhpUnitBridge] Bump PHPUnit 7+8
2019-06-16 13:16:34 +02:00
Roland Franssen
5491d5347c [PhpUnitBridge] Bump PHPUnit 7+8 2019-06-16 13:16:20 +02:00
Fabien Potencier
db1543514e bug #32040 [DI] Show the right class autowired when providing a non-existing class (Simperfit)
This PR was merged into the 4.3 branch.

Discussion
----------

[DI] Show the right class autowired when providing a non-existing class

| Q             | A
| ------------- | ---
| Branch?        4.3
| Bug fix?      | yes
| 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 | #31997   <!-- #-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 gets the last current id before the error and pass it to the callback in order to get the right error message.

Commits
-------

fbda90af6e [DI] Show the right class autowired when providing a non-existing class in constructor
2019-06-16 13:15:10 +02:00
Amrouche Hamza
fbda90af6e
[DI] Show the right class autowired when providing a non-existing class in constructor 2019-06-15 06:08:07 +02:00
Nicolas Grekas
7cf3fb4a21 Prepare for PHP 7.4 preload 2019-06-15 00:30:02 +02:00
Tobias Schultze
0034dee641 [Messenger] make retry logic work without SentStamp 2019-06-14 23:41:22 +02:00
Tobias Schultze
9f6cbaa6b9 minor #32047 [Validator] prevent double deprecation message (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[Validator] prevent double deprecation message

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

Commits
-------

ecded5ed03 prevent double deprecation message
2019-06-14 20:10:10 +02:00
Tobias Schultze
a9bcdcc936 bug #32035 [Messenger] fix delay delivery for non-fanout exchanges (Tobion)
This PR was merged into the 4.3 branch.

Discussion
----------

[Messenger] fix delay delivery for non-fanout exchanges

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| 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 |
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Fixes two bugs and outdated phpdoc:
1. When your exchange is not of type fanout, but direct for example, then delivery of delayed (retrying) messages does not work. This is because the delay logics adds a routing key to message. It was fixed if you have a custom routing key in #31355. But if you have no routing key, it still changed the routing key which means the message will not be delivery from your direct exchange to your queue anymore after being in the delay exchange. For fanout, which is the default, it does not matter because the routing key is ignored.
2. also fix dsn parsing of plain `amqp://` which is a valid URI that parse_url cannot handle when you want to pass all parameters as options

Commits
-------

0f15306d61 [Messenger] fix delay delivery for non-fanout exchanges
2019-06-14 19:11:46 +02:00
Christian Flothmann
ecded5ed03 prevent double deprecation message 2019-06-14 16:37: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
68d1b3fab7 feature #32041 [Validator] Deprecate unused arg in ExpressionValidator (ogizanagi)
This PR was merged into the 4.4 branch.

Discussion
----------

[Validator] Deprecate unused arg in ExpressionValidator

| Q             | A
| ------------- | ---
| Branch?       | 4.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 <!-- 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 <!-- required for new features -->

Time to deprecate this unused first argument?

Commits
-------

0c0978cd47 [Validator] Deprecate unused arg in ExpressionValidator
2019-06-14 10:56:41 +02:00
Maxime Steinhausser
0c0978cd47 [Validator] Deprecate unused arg in ExpressionValidator 2019-06-14 10:40:37 +02:00
Fabien Potencier
6b50c89d76 bug #32022 [HttpClient] Don't use CurlHttpClient on Windows when curl.cainfo is not set (nicolas-grekas)
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] Don't use CurlHttpClient on Windows when curl.cainfo is not set

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

On Windows, curl has no cabundle configured by default.

Commits
-------

a2960a3318 [HttpClient] Don't use CurlHttpClient on Windows when curl.cainfo is not set
2019-06-14 10:02:21 +02:00
Fabien Potencier
50c62d7704 feature #31287 [Config] Introduce find method in ArrayNodeDefinition to ease configuration tree manipulation (jschaedl)
This PR was squashed before being merged into the 4.4 branch (closes #31287).

Discussion
----------

[Config] Introduce find method in ArrayNodeDefinition to ease configuration tree manipulation

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | #27534   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | tbd.

### Description

This PR introduces a new `find(string $nodePath)`method in the `ArrayNodeDefinition` class, which helps you finding the right node to prepend configuration to ease configuration tree manipulation.

### How to use it
```php
class Configuration implements ConfigurationInterface
{
    public function getConfigTreeBuilder()
    {
        ...

        $rootNode
            ->children()
                ->arrayNode('social_media_channels')
                    ->children()
                        ->booleanNode('enable')->end()
                        ->arrayNode('twitter')->end()
                        ->arrayNode('facebook')->end()
                        ->arrayNode('instagram')->end()
                    ->end()
                ->end()
            ->end()
        ;

        $this->changeSocialMediaChannelConfiguration($rootNode->find('social_media_channels.enable'));
        $this->addTwitterConfiguration($rootNode->find('social_media_channels.twitter'));
        $this->addFacebookConfiguration($rootNode->find('social_media_channels.facebook'));
        $this->addInstagramConfiguration($rootNode->find('social_media_channels.instagram'));

        return $treeBuilder;
    }

    private function changeSocialMediaChannelConfiguration(NodeDefinition $node)
    {
        $node
            ->defaultTrue()
        ;
    }

    private function addTwitterConfiguration(NodeDefinition $node)
    {
        $node
            ->children()
                ->integerNode('client_id')->end()
                ->scalarNode('client_secret')->end()
            ->end()
        ;
    }

    private function addFacebookConfiguration(NodeDefinition $node)
    {
        $node
            ->children()
                ->integerNode('client_id')->end()
                ->scalarNode('client_secret')->end()
            ->end()
        ;
    }

    private function addInstagramConfiguration(NodeDefinition $node)
    {
        $node
            ->children()
                ->integerNode('client_id')->end()
                ->scalarNode('client_secret')->end()
            ->end()
        ;
    }
}

```

Commits
-------

e3b248aee0 [Config] Introduce find method in ArrayNodeDefinition to ease configuration tree manipulation
2019-06-14 09:59:19 +02:00
Jan Schädlich
e3b248aee0 [Config] Introduce find method in ArrayNodeDefinition to ease configuration tree manipulation 2019-06-14 09:59:12 +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
f06a35b974 feature #31959 [DomCrawler][Feature][DX] Add Form::getName() method (JustBlackBird)
This PR was squashed before being merged into the 4.4 branch (closes #31959).

Discussion
----------

[DomCrawler][Feature][DX] Add Form::getName() method

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | None
| License       | MIT
| Doc PR        | symfony/symfony-docs#11705

The PR adds `Symfony\Component\DomCrawler\Form::getName` method.

The method is actually a syntax sugar but can improve DX when dealing with tests. For example, in the snippet

```php
$client = static::createClient();
$crawler = $client->request('GET', '/post/hello-world');
$form = $crawler->selectButton('submit')->form();

$form['my_form[name]'] = 'Fabien';
$form['my_form[subject]'] = 'Symfony rocks!';
```
the prefix in field name (`my_form`) is form name, which is generated by Symfony automatically. The method, added in the PR helps to get that name in a most obvious way.

Commits
-------

ff53cb462a [DomCrawler][Feature][DX] Add Form::getName() method
2019-06-14 07:15:47 +02:00
Dmitry Simushev
ff53cb462a [DomCrawler][Feature][DX] Add Form::getName() method 2019-06-14 07:15:39 +02:00
Fabien Potencier
e02da2ab35 bug #32036 [Messenger] improve logs (Tobion)
This PR was merged into the 4.3 branch.

Discussion
----------

[Messenger] improve logs

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| 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 |
| License       | MIT
| Doc PR        |

The logs are currently very confusing and duplicated:

- When handled sync the uncaught error it logged and displayed by the console / http error handler anyway. Currently it the warning is duplicated and useless:

```
14:26:11 WARNING   [messenger] An exception occurred while handling message "{class}": OUCH, THAT HURTS! GO TO MOM!
14:26:11 ERROR     [console] Error thrown while running command "{class}". Message: "OUCH, THAT HURTS! GO TO MOM!"

In HandleMessageMiddleware.php line 82:

  [Symfony\Component\Messenger\Exception\HandlerFailedException]
  OUCH, THAT HURTS! GO TO MOM!
```

- When handling async is was even confusing because the actual error was logged as warning and the retry (which is a good thing) was the error.

```
13:48:15 WARNING   [messenger] An exception occurred while handling message "{class}": OUCH, THAT HURTS! GO TO MOM!
13:48:15 ERROR     [messenger] Retrying {class} - retry #1.
```

Now it's must clearer and adds even context like the delay:

```
16:20:11 ERROR     [messenger] Error thrown while handling message {class}. Dispatching for retry #3 using 4000 ms delay. Error: "OUCH, THAT HURTS! GO TO MOM!"
...
16:20:15 CRITICAL  [messenger] Error thrown while handling message {class}. Removing from transport after 3 retries. Error: "OUCH, THAT HURTS! GO TO MOM!"
```

Commits
-------

2ac7027b71 [Messenger] improve logs
2019-06-14 07:10:33 +02:00
Fabien Potencier
d7ba773959 bug #31998 Parameterize Mailgun's region (jderusse)
This PR was merged into the 4.3 branch.

Discussion
----------

Parameterize Mailgun's region

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

Mailgun is available in 2 regions (US and EU), when registering a custom domain, users can choose one of the 2 regions and **have to** use the right the endpoint (see documentation https://documentation.mailgun.com/en/latest/api-intro.html?highlight=smtp.mailgun.org#mailgun-regions).

This PR make the endpoint/region configurable.

Commits
-------

7439c8de55 Parameterize Mailgun's region
2019-06-14 07:03:50 +02:00
Tobias Schultze
2ac7027b71 [Messenger] improve logs 2019-06-14 05:35:37 +02:00
Tobias Schultze
0f15306d61 [Messenger] fix delay delivery for non-fanout exchanges
also fix dsn parsing of plain amqp:// uri
2019-06-14 02:31:20 +02:00
Jérémy Derussé
7439c8de55
Parameterize Mailgun's region 2019-06-13 19:53:12 +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
9865988ac2 bug #32012 Add statement to fileLink to ignore href code when no fileLink. (bmxmale)
This PR was merged into the 4.3 branch.

Discussion
----------

Add statement to fileLink to ignore href code when no fileLink.

| Q             | A
| ------------- | ---
| Branch?       | 4.3 <!-- see below -->
| Bug fix?      | yes
| 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 | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- 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 fix add statement to `\Symfony\Bundle\FrameworkBundle\Console\Descriptor\TextDescriptor::formatControllerLink` to fix display bug.

**Before**

![image](https://user-images.githubusercontent.com/23213308/59355771-ed8a1000-8d27-11e9-998f-fa2fc34edd62.png)

**After**

![image](https://user-images.githubusercontent.com/23213308/59355785-f2e75a80-8d27-11e9-953b-7523e0c9ad35.png)

Commits
-------

b9eab42823 Add statement to fileLink to ignore href code when no fileLink.
2019-06-13 18:41:02 +02:00
Fabien Potencier
bad18dc4ac feature #32026 [VarDumper] caster for HttpClient's response dumps all info (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[VarDumper] caster for HttpClient's response dumps all info

| 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        | -

No need to dump the internal structure for responses IMHO, here is a caster that dumps the info instead:

![image](https://user-images.githubusercontent.com/243674/59434490-efb5a280-8deb-11e9-8714-5f1ccbc208b1.png)

Commits
-------

2b268379f5 [VarDumper] caster for HttpClient's response dumps all info
2019-06-13 18:38:05 +02:00
Nicolas Grekas
2b268379f5 [VarDumper] caster for HttpClient's response dumps all info 2019-06-13 18:29:46 +02:00