Commit Graph

40870 Commits

Author SHA1 Message Date
Alexis Lefebvre
60ad109533 [Workflow] Add colors to workflow dumps 2019-03-19 06:08:23 +01:00
Nyholm
903355fbcc Support for handling messages after current bus is finished
Co-authored-by: Maxime Steinhausser <ogizanagi@users.noreply.github.com>
2019-03-19 05:15:31 +01:00
Nicolas Grekas
2ff8c19609 bug #30594 [HttpClient] changes minimal php version to use curl push function (XuruDragon)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[HttpClient] changes minimal php version to use curl push function

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

Adding some changes to CurlHttpClient to avoid potential bugs in php < 7.2.17 or php < 7.3.4.
For more information check these bugs :
- https://bugs.php.net/bug.php?id=77747
- https://bugs.php.net/bug.php?id=77535

Resolve by the following commit by Nikic :
- 97f9fd6949

Commits
-------

01a663aea0 [HttpClient] changes minimal php version to use curl push function
2019-03-18 16:16:35 +01:00
Anthony MARTIN
01a663aea0 [HttpClient] changes minimal php version to use curl push function 2019-03-18 16:11:55 +01:00
Nicolas Grekas
ac93c9ece8 feature #28975 [DI] Add an url EnvProcessor (jderusse)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[DI] Add an url EnvProcessor

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/11128

This PR add a new env processor `url` to convert an URL (or DSN) into an array.

The main goal is to simplify the project configuration and reduce the number of env variable when working with bundle which are not able to deal with DSN
(pick some random project in symfony/recipes-contrib: https://github.com/symfony/recipes-contrib/blob/master/facile-it/mongodb-bundle/0.6/manifest.json or https://github.com/symfony/recipes-contrib/blob/master/wouterj/eloquent-bundle/1.0/manifest.json)

```yaml
# before
MONGODB_HOST=localhost
MONGODB_PORT=27017
MONGODB_USER=
MONGODB_PASSWORD=
MONGODB_DB=symfony

mongo_db_bundle:
    data_collection: '%kernel.debug%'
    clients:
        default:
            hosts:
            - { host: '%env(MONGODB_HOST)%', port: '%env(int:MONGODB_PORT)%' }
            username: '%env(MONGODB_USER)%'
            password: '%env(MONGODB_PASSWORD)%'
            connectTimeoutMS: 3000
    connections:
        default:
            database_name: '%env(MONGODB_DB)%'

# after
MONGODB_DSN=mongodb://localhost:27017/symfony

mongo_db_bundle:
    data_collection: '%kernel.debug%'
    clients:
        default:
            hosts:
            - { host: '%env(key:host:url:MONGODB_DSN)%', port: '%env(key:port:url:MONGODB_DSN)%' }
            username: '%env(key:user:url:MONGODB_DSN)%'
            password: '%env(key:pass:url:MONGODB_DSN)%'
            connectTimeoutMS: 3000
    connections:
        default:
            database_name: '%env(key:path:url:MONGODB_DSN)%'
```

Added also a `query_string` processor to parse query string

```
DATABASE_DSN=mysql://localhost/db?charset=utf8

foo:
  bar:
    charset: '%env(key:charset:query_string🔑query:url:DATABASE_DSN)%'
```

Commits
-------

f253c9b7ca Add an url EnvProcessor
2019-03-18 12:19:06 +01:00
Matthias Althaus
d8092c7b7b Fixed usage of TranslatorInterface in form extension (fixes #30591) 2019-03-18 11:22:47 +01:00
Jérémy Derussé
f253c9b7ca
Add an url EnvProcessor 2019-03-17 18:30:10 +01:00
Nicolas Grekas
401c1d3d75 feature #30419 [FrameworkBundle] Add integration of http-client component (Ioni14, nicoweb)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[FrameworkBundle] Add integration of http-client component

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

This PR adds the integration of the HttpClient component on FrameworkBundle.
By default, two services are provided, one implementing SFC-HttpClient, and another PSR18:
* `http_client` + its autowiring alias for `Symfony\Contracts\HttpClient\HttpClientInterface`)
This service is automatically set to the best HTTP client available with the configuration given under the `framework.http_client` key.
* `psr18.http_client` + its autowiring alias for `Psr\Http\Client\ClientInterface`). To make it work, one needs to provide autowiring aliases for `ResponseFactoryInterface` and `StreamFactoryInterface`, which are provided by [the recipe](https://github.com/symfony/recipes-contrib/blob/master/nyholm/psr7/1.0/config/packages/nyholm_psr7.yaml) for `nyholm/psr7` (but could be overriden by apps when using something else).

* one can also configure the default options, and "scoped" clients. For example:
```yaml
http_client:
    default_options:
        capath: '...'
    clients:
        github_client:
            default_options:
                base_uri: 'https://api.github.com'
```

This definition create a `github_client` service implementing SFC-HttpClient and a `psr18.github_client` one implementing PSR18, +2 corresponding named autowiring aliases: `HttpClientInterface $githubClient`,  and `ClientInterface $githubClient`.

Commits
-------

f2d2cf3021 work with attributes for xml config
0023a71260 [FrameworkBundle] Add integration of http-client component
2019-03-17 18:02:43 +01:00
nicoweb
f2d2cf3021 work with attributes for xml config 2019-03-17 17:54:33 +01:00
Nicolas Grekas
f88cb07d30 [DI] revert bad patch in previous PR 2019-03-17 17:47:41 +01:00
Thomas Talbot
0023a71260 [FrameworkBundle] Add integration of http-client component 2019-03-17 17:08:17 +01:00
Nicolas Grekas
3abf9ebc03 bug #30589 [DI] fix casting AutowiringFailedException to string when its callback throws (nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[DI] fix casting AutowiringFailedException to string when its callback throws

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

ping @weaverryan

Commits
-------

d57a148b8b [DI] fix casting AutowiringFailedException to string when its callback throws
2019-03-17 17:05:00 +01:00
Nicolas Grekas
d57a148b8b [DI] fix casting AutowiringFailedException to string when its callback throws 2019-03-17 16:55:03 +01:00
Fabien Potencier
0c6f0b4a44 feature #30583 [Messenger] Display a nice error when connection fail (lyrixx)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Messenger] Display a nice error when connection fail

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

### Before:

![image](https://user-images.githubusercontent.com/408368/54469293-6bc12f80-4796-11e9-897c-f07504132214.png)

### Now:

![image](https://user-images.githubusercontent.com/408368/54469287-5c41e680-4796-11e9-80ac-692899693542.png)

Commits
-------

eac014febd [Messenger] Display a nice error when connection fail
2019-03-17 14:07:58 +01:00
Grégoire Pineau
eac014febd [Messenger] Display a nice error when connection fail 2019-03-17 13:27:48 +01:00
Fabien Potencier
affaa45537 minor #30588 [Intl][4.2] Fix test (ro0NL)
This PR was merged into the 4.2 branch.

Discussion
----------

[Intl][4.2] Fix 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 | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Related to #30584 , the tests we're missing updated fixtures. My bad also 😅

Now fixed, while at it recompiled intl for 4.2 ✌️

Commits
-------

50b52cffdd [Intl][4.2] Fix test
2019-03-17 11:54:37 +01:00
Fabien Potencier
42c08b8966 minor #30587 [Intl] Fix test (ro0NL)
This PR was merged into the 3.4 branch.

Discussion
----------

[Intl] Fix test

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | yes/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 | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Creates some weird path, that breaks the next tests.

Commits
-------

226f522c4d [Intl] Fix test
2019-03-17 11:53:39 +01:00
Roland Franssen
50b52cffdd [Intl][4.2] Fix test 2019-03-17 10:32:54 +01:00
Roland Franssen
226f522c4d
[Intl] Fix test 2019-03-17 10:26:14 +01:00
Fabien Potencier
0762d2d9ac feature #30450 [Profiler] Render the performance graph with SVG (Tom32i)
This PR was squashed before being merged into the 4.3-dev branch (closes #30450).

Discussion
----------

[Profiler] Render the performance graph with SVG

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | Part 1, 3 and 4 of #27262
| License       | MIT
| Doc PR        | n/a

Following a suggestion by @ogizanagi in #27262,
Here's a proposal to render the Request Graph, from the performance profiler panel, with SVG instead of canvas.

Some benefits of the SVG format:
- The text labels are searchable and can be selected.
- It renders well on high DPI monitors.
- [Colors and text styles](https://github.com/symfony/symfony/issues/27262#issuecomment-388868068) can be defined with CSS just like the rest of the page.

In addition, SVG allow us to consider (and easily implement) interactives features such as:
- Zoom in and time navigation (thanks to the viewport).
- Highlight hovered line (or other DOM related events).

Preview:

![screenshot_2019-03-08 symfony profiler 1](https://user-images.githubusercontent.com/1846873/54036727-a33f4300-41bc-11e9-8be7-b1de10d4afd9.png)

Filtered events example:

![capture d ecran 2019-03-08 a 17 22 47](https://user-images.githubusercontent.com/1846873/54041039-00d88d00-41c7-11e9-9590-23e809415c34.png)

### Progress :
- [x] Render request events in SVG
- [x] Show labels with duration and memory
- [x] Show specific markers at start / end of lines
- [x] Re-render graph when window resize
- [x] Re-render graph when threshold change.
- [x]  Generate graph legend with only existing categories (part 1. of #27262 )
- [x] Show sub-request area with hatched pattern
- [x]  Allow to hide categories by clicking them on the legend (part 3. of #27262 )
- [x] Handle text overflow on long labels.
- [x] Ensure JS code is compatible with all supported browsers (used [classes](https://caniuse.com/#feat=es6-class) and [arrow functions](https://caniuse.com/#feat=arrow-functions).
- ~Add left-padding to sub-request graph?~

Commits
-------

a69a718ec9 [Profiler] Render the performance graph with SVG
2019-03-17 08:47:26 +01:00
Thomas Jarrand
a69a718ec9 [Profiler] Render the performance graph with SVG 2019-03-17 08:47:19 +01:00
Fabien Potencier
83aeef1907 minor #30534 [Form] Fixed some phpdocs (Jules Pietri)
This PR was merged into the 3.4 branch.

Discussion
----------

[Form] Fixed some phpdocs

| 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        | https://github.com/symfony/symfony-docs/pull/6393

ref https://github.com/symfony/symfony-docs/issues/6144, https://github.com/symfony/symfony-docs/pull/6297, https://github.com/symfony/symfony/pull/14050

Commits
-------

b9162e8cfb [Form] Fixed some phpdocs
2019-03-17 08:27:38 +01:00
Fabien Potencier
d7fdcb1a5d minor #30549 [HttpClient] Make exceptions public (dunglas)
This PR was squashed before being merged into the 4.3-dev branch (closes #30549).

Discussion
----------

[HttpClient] Make exceptions public

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no<!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| 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 | #...   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | n/a

Makes it easier to implement the interface. See api-platform/core#2608

Commits
-------

928d774e4a [HttpClient] Make exceptions public
2019-03-17 08:23:56 +01:00
Kévin Dunglas
928d774e4a [HttpClient] Make exceptions public 2019-03-17 08:23:49 +01:00
Fabien Potencier
b4431769a1 feature #29130 [Serializer] Normalize constraint violation parameters (ogizanagi)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Serializer] Normalize constraint violation parameters

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | no
| New feature?  | yes <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | yes <!-- 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 | N/A   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A?

Adding violation constraints' parameters to the normalized data, as these are valuable for an API client.

I used `parameters` for now, as it's the name used in `ConstraintViolationInterface::getParameters()`, but what about `placeholders` or `context`?

Commits
-------

32c90ebc8e [Serializer] Normalize constraint violation parameters
2019-03-17 08:15:05 +01:00
Fabien Potencier
6fa4d2b0cf feature #28330 [MonologBridge] Add monolog processors adding route and command info (trakos)
This PR was squashed before being merged into the 4.3-dev branch (closes #28330).

Discussion
----------

[MonologBridge] Add monolog processors adding route and command info

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

This PR adds two simple processors that add context to every log entry.

RouteProcessor adds routing information:
`app.INFO: Some log text {"someContext":"ctx"} {"route":{"controller":"App\\Controller\\SomeController::number","route":"index","route_params":[]}`

ConsoleCommandProcessors adds current command information:
`app.INFO: Some log text {"someContext":"ctx"} {"command":{"name":"app:some-command","arguments":{"command":"app:some-command","some-argument":10}}}`

For ConsoleCommandProcessor I've decided against including command options by default, because there's a lot of default ones:
`"options":{"help":false,"quiet":false,"verbose":false,"version":false,"ansi":false,"no-ansi":false,"no-interaction":false,"env":"dev","no-debug":false}`. This behavior can be changed with a constructor argument.

Commits
-------

669f6b2726 [MonologBridge] Add monolog processors adding route and command info
2019-03-17 08:08:51 +01:00
Piotr Stankowski
669f6b2726 [MonologBridge] Add monolog processors adding route and command info 2019-03-17 08:08:42 +01:00
Fabien Potencier
cbb0b81ebd feature #30339 [Monolog] Disable DebugLogger in CLI (lyrixx)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Monolog] Disable DebugLogger in CLI

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   |
| Fixed tickets | #30333 https://github.com/symfony/monolog-bundle/issues/165 #25876
| License       | MIT
| Doc PR        |

<details>
<summary>Considering this code:</summary>

```php
namespace App\Command;

use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class LeakCommand extends Command
{
    protected static $defaultName = 'leak';

    private $logger;

    public function __construct(LoggerInterface $logger)
    {
        $this->logger = $logger;

        parent::__construct();
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $reportedAt = time();
        while (true) {
            $this->logger->info('Hello');

            if (time() - $reportedAt >= 1) {
                $output->writeln(sprintf('%dMb', memory_get_usage() / 1024 / 1024));
                $reportedAt = time();
            }
        }
    }
}
```

</details>

Without the patch
```
>…/dev/labs/symfony/website-skeleton(monolog %) bin/console leak
7Mb
28Mb
51Mb
76Mb
97Mb
````

With the patch
```
>…/dev/labs/symfony/website-skeleton(monolog %) bin/console leak
6Mb
6Mb
6Mb
6Mb
```

Commits
-------

17533da49c [Monolog] Disable DebugLogger in CLI
2019-03-17 07:59:53 +01:00
Fabien Potencier
218f29051d feature #30584 [Intl] Add compile binary (ro0NL)
This PR was merged into the 3.4 branch.

Discussion
----------

[Intl] Add compile binary

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

Compile the Intl data by invoking a single command, and make it work out-of-the-box. (Split from #28831)

```bash
$ src/Symfony/Component/Intl/Resources/bin/compile
```

run in repository root because of

b7e798ef74/src/Symfony/Component/Intl/Data/Generator/LocaleDataGenerator.php (L141)

3.4 is ok, 4.2 is not because of #28833 but new locales are introduced in https://github.com/symfony/symfony/pull/28977/files#diff-f52da32e1ee6b93598814090d0749aa6R1

So as long as 3.4 is supported, but branches above add filters etc. during generation we're risking this discrepancy. I suggest after merge in upper branches to re-run `compile` (potential for automating, but run if needed :))

Commits
-------

426b92f4a8 [Intl] Add compile binary
2019-03-17 07:57:13 +01:00
Fabien Potencier
89f2a47034 minor #30585 [Validator] Add the missing translations for the Arabic (ar) locale (mehdimabrouk)
This PR was submitted for the master branch but it was merged into the 3.4 branch instead (closes #30585).

Discussion
----------

[Validator] Add the missing translations for the Arabic (ar) locale

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | ?    <!-- 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 -->

This pull request is for adding missing translations in validators.ar.xlf.
<!--
Write a short README entry for your feature/bugfix here (replace this comment block.)
This will help people understand your PR and can be used as a start of the Doc PR.
Additionally:
 - Bug fixes must be submitted against the lowest 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 the master branch.
-->

Commits
-------

5df08d67a7 [Validator] Add the missing translations for the Arabic (ar) locale
2019-03-17 07:52:27 +01:00
Mehdi Mabrouk
5df08d67a7 [Validator] Add the missing translations for the Arabic (ar) locale 2019-03-17 07:52:21 +01:00
Fabien Potencier
31be5cf42e feature #30579 Using AMQP auto-setup in all cases, not just in debug (weaverryan)
This PR was merged into the 4.3-dev branch.

Discussion
----------

Using AMQP auto-setup in all cases, not just in debug

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes and no
| New feature?  | no
| BC breaks?    | yes
| Deprecations? | no->
| Tests pass?   | yes
| Fixed tickets | Related to #29476
| License       | MIT
| Doc PR        | TODO

Currently AMQP does auto-setup of queues/exchanges in dev-mode only. That's a problem for 2 reasons:

1) Behavior in prod is drastically different... and actually... there's not currently a way I know of (easily) to set things up on prod.

2) One of the properties of AMQP is that you typically DO want things to be set up at runtime, as you need them - you usually *do* want auto-setup.

This changes the behavior to auto-setup true always.

Commits
-------

503c20989c Using AMQP auto-setup in all cases, not just in debug
2019-03-17 07:49:53 +01:00
Ryan Weaver
503c20989c Using AMQP auto-setup in all cases, not just in debug 2019-03-16 20:39:02 -04:00
Roland Franssen
426b92f4a8 [Intl] Add compile binary 2019-03-16 10:12:20 +01:00
Nicolas Grekas
b7e798ef74 Merge branch '4.2'
* 4.2:
  Fix Cache error while using anonymous class
  [Cache] fix LockRegistry
  Update validators.cs.xlf
  Make translations consistent with other translations.
  Correct language code for ukrainian language in security translations.
  Fix return type of Request::getRequestFormat
  [Cache] Fix perf when using RedisCluster by reducing roundtrips to the servers
2019-03-15 14:38:03 +01:00
Nicolas Grekas
e9814030c6 Merge branch '3.4' into 4.2
* 3.4:
  Fix Cache error while using anonymous class
  Update validators.cs.xlf
2019-03-15 14:37:34 +01:00
Nicolas Grekas
613bc421cd bug #30487 Fix Cache error while using anonymous class (Emmanuel BORGES)
This PR was merged into the 3.4 branch.

Discussion
----------

Fix Cache error while using anonymous class

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

Fix Cache error while using anonymous class

Commits
-------

036e72210d Fix Cache error while using anonymous class
2019-03-15 14:35:18 +01:00
Emmanuel BORGES
036e72210d Fix Cache error while using anonymous class 2019-03-15 14:32:44 +01:00
Nicolas Grekas
040dc7bc09 feature #30348 [DependencyInjection] Add ability to define an index for service in an injected service locator argument (XuruDragon, nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[DependencyInjection] Add ability to define an index for service in an injected service locator argument

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | in progress /  symfony/symfony-docs#...

It's more or less the same thing then the PR #30257 but for a service locator argument

Add a simple way to specify an index based on a tag attribute to simplify retrieving a specific service when injecting a service locator as argument into services, but also a way to fallback to a static method on the service class.

Yaml:
```yaml
services:
  foo_service:
    class: Foo
    tags:
      - {name: foo_tag, key: foo_service}
  foo_service_tagged:
    class: Bar
    arguments:
      - !tagged_locator
          tag: 'foo_tag'
          index_by: 'key'
          default_index_method: 'static_method'
```
XML:
```xml
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services
    http://symfony.com/schema/dic/services/services-1.0.xsd">
  <services>
    <service id="foo" class="Foo">
        <tag name="foo_tag" key="foo_service" />
    </service>
    <service id="foo_tagged_iterator" class="Bar" public="true">
      <argument type="tagged_locator" tag="foo_tag" index-by="key" default-index-method="static_method" />
    </service>
  </services>
</container>
```
PHP:
```php
// config/services.php
use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument;
use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument;

$container->register(Foo::class)
        ->addTag('foo_tag', ['key' => 'foo_service']);

$container->register(App\Handler\HandlerCollection::class)
         // inject all services tagged with app.handler as first argument
         ->addArgument(new ServiceLocatorArgument(new TaggedIteratorArgument('app.handler', 'key')));
```

Usage:
```php
// src/Handler/HandlerCollection.php
namespace App\Handler;

use Symfony\Component\DependencyInjection\ServiceLocator;

class HandlerCollection
{
     public function __construct(ServiceLocator $serviceLocator)
     {
           $foo = $serviceLocator->get('foo_service'):
     }
}
```

Tasks

* [x]  Support PHP loader/dumper
* [x]  Support YAML loader/dumper
* [x]  Support XML loader/dumper (and update XSD too)
* [x]  Add tests
* [x]  Documentation

Commits
-------

cb3c56bc0c Support indexing tagged locators by FQCN as fallback
250a2c8332 [DI] Allow tagged_locator tag to be used as an argument
2019-03-15 14:02:50 +01:00
Nicolas Grekas
f6662539aa feature #30469 Create a hyperlink to interfaces/classes that can be autowired (SerkanYildiz)
This PR was squashed before being merged into the 4.3-dev branch (closes #30469).

Discussion
----------

Create a hyperlink to interfaces/classes that can be autowired

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

Added hyperlink to definition of interfaces/classes that can be used for autowiring.
But I need help with:
- the aliases are becoming hyperlinks too, but shouldn't.
It's outputting `<fg=yellow;href=phpstorm://open?file=filepath&line=17>Symfony\Contracts\Translation\TranslatorInterface</> <fg=cyan>(translator.default)</>`

- it currently works with phpstorm because it's hardcoded but it should work with framework.ide option, but don't know what the best approach is to support that config option.

Commits
-------

a3dfcee406 Create a hyperlink to interfaces/classes that can be autowired
2019-03-15 13:59:08 +01:00
Serkan Yildiz
a3dfcee406 Create a hyperlink to interfaces/classes that can be autowired 2019-03-15 13:59:00 +01:00
Nicolas Grekas
13c32a972a bug #30576 [Cache] fix LockRegistry (nicolas-grekas)
This PR was merged into the 4.2 branch.

Discussion
----------

[Cache] fix LockRegistry

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

- Locking doesn't work right now, because of this missing return statement.
I can't provide a useful test case, because this is effective only when race conditions happen...
- Writing the value should happen within the boundaries of the lock.
- The `final` keyword is really missing, there are zero reasons to extend this class, adding it asap will make it clear and will unlock progress on this class.
- Lastly, a type-hint fix is shipped here also.

Commits
-------

f49df4ab05 [Cache] fix LockRegistry
2019-03-15 13:52:36 +01:00
Nicolas Grekas
05fe6a939a feature #30334 [DI] add ReverseContainer: a locator that turns services back to their ids (nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[DI] add ReverseContainer: a locator that turns services back to their ids

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

This PR introduces a `ReverseContainer`, which is a class you can type hint for to get it as a service.

When you have a `ReverseContainer` at hand, you can then use it to know the service id of an object (if the object is not found, `null` is returned):
`$id = $reverseContainer->getId($someObject);`

You can also call `$reverseContainer->getService($id);` and get the service in return.

To be reversible, a service must either be public or be tagged with `container.reversible`.

I'm using this feature to serialize service references in a message, then send them through a Messenger bus, allowing the handler on the other side to use that referenced service to process the message. More specifically, my use case is sending messages for early cache expiration events through a bus and have a worker compute the soon-to-expire value in the background. The reversible services are the computation callbacks and the cache pools I need to compute the value for.

Commits
-------

ac1e4291e8 [DI] add ReverseContainer: a locator that turns services back to their ids
2019-03-15 13:51:46 +01:00
Nicolas Grekas
a116347e99 feature #30539 [Messenger] deprecate LoggingMiddleware in favor of providing a logger to SendMessageMiddleware (nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[Messenger] deprecate LoggingMiddleware in favor of providing a logger to SendMessageMiddleware

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

Discussing with @simensen, we figured out the currently logged messages are not precise enough.
Logging is a cross-cutting concern: splitting it in a dedicated middleware means losing details - or building complexity.
Let's make things simple and log the best messages depending on the internal situation.

While the component is experimental, removing the `LoggingMiddleware` altogether would break FrameworkBundle 4.2 when it is used with Messenger 4.3. Not worth the trouble when it's two lines to deprecate IMHO.

Commits
-------

2bff625abe [Messenger] deprecate LoggingMiddleware in favor of providing a logger to SendMessageMiddleware
2019-03-15 13:50:41 +01:00
Nicolas Grekas
9ee5ff775d minor #30561 [HttpClient] strengthen bearer validation (nicolas-grekas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[HttpClient] strengthen bearer validation

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

Better be sure CR/LF/etc cannot be passed inside raw header values, opening potential security risks.

Commits
-------

e6e162075d [HttpClient] strengthen bearer validation
2019-03-15 13:49:26 +01:00
Nicolas Grekas
f49df4ab05 [Cache] fix LockRegistry 2019-03-15 12:55:58 +01:00
Nicolas Grekas
ac1e4291e8 [DI] add ReverseContainer: a locator that turns services back to their ids 2019-03-14 17:23:04 +01:00
Nicolas Grekas
e6e162075d [HttpClient] strengthen bearer validation 2019-03-14 12:13:43 +01:00
Nicolas Grekas
59e63805a3 minor #30564 [HttpClient] Fix HttpOptions::setAuthBearer() (dunglas)
This PR was merged into the 4.3-dev branch.

Discussion
----------

[HttpClient] Fix HttpOptions::setAuthBearer()

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| 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 | n/a   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | n/a

I messed up the option name while rebasing...

Commits
-------

7308e5a8e6 [HttpClient] Fix HttpOptions::setAuthBearer()
2019-03-14 12:10:39 +01:00
Fabien Potencier
357fe5d6c3 minor #30566 [Validator] Add the missing translations for the Czech ("cs") locale (dfridrich)
This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] Add the missing translations for the Czech ("cs") locale

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

Add the missing translations for the Czech ("cs") locale to Validator.

Commits
-------

5f49e6c4d5 Update validators.cs.xlf
2019-03-14 11:49:53 +01:00