Commit Graph

49871 Commits

Author SHA1 Message Date
Bohan Yang
147b6adc39 [HttpClient] Fix promise behavior in HttplugClient 2020-07-04 11:37:14 +02:00
Nicolas Grekas
e6e1ca38c0 Merge branch '5.1'
* 5.1:
  [Console] fix reading from STDIN
2020-07-04 11:30:53 +02:00
Nicolas Grekas
5de5b7d82e Merge branch '5.0' into 5.1
* 5.0:
  [Console] fix reading from STDIN
2020-07-04 11:30:46 +02:00
Nicolas Grekas
c2c4d4dc12 Merge branch '4.4' into 5.0
* 4.4:
  [Console] fix reading from STDIN
2020-07-04 11:30:38 +02:00
Nicolas Grekas
5da153603b [Console] fix reading from STDIN 2020-07-04 11:30:27 +02:00
Nicolas Grekas
901e938da3 Merge branch '5.1'
* 5.1:
  [HttpClient][CurlHttpClient] Fix http_version option usage
  [HttpClient] fix parsing response headers in CurlResponse
  [PropertyAccess] Remove inflector component
  [Console] Do not check for "stty" using "exec" if that function is disabled
  [Console] always use stty when possible to ask hidden questions
2020-07-03 20:06:54 +02:00
Nicolas Grekas
a815bc2b41 Merge branch '5.0' into 5.1
* 5.0:
  [HttpClient][CurlHttpClient] Fix http_version option usage
  [HttpClient] fix parsing response headers in CurlResponse
  [Console] Do not check for "stty" using "exec" if that function is disabled
  [Console] always use stty when possible to ask hidden questions
2020-07-03 20:06:49 +02:00
Nicolas Grekas
f9225109e4 Merge branch '4.4' into 5.0
* 4.4:
  [HttpClient][CurlHttpClient] Fix http_version option usage
  [HttpClient] fix parsing response headers in CurlResponse
  [Console] Do not check for "stty" using "exec" if that function is disabled
  [Console] always use stty when possible to ask hidden questions
2020-07-03 20:06:40 +02:00
Nicolas Grekas
fec23313e7 bug #37469 [Console] always use stty when possible to ask hidden questions (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[Console] always use stty when possible to ask hidden questions

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

The current code doesn't make much sense: we check `hasSttyAvailable()`, and if the answer is `false`, we still use `stty` directly.

This PR relies on `stream_isatty` and equivalent fallback checks to decide if the password can be hidden or not.

Best reviewed [ignoring whitespaces](https://github.com/symfony/symfony/pull/37469/files?w=1).

Commits
-------

055b605e30 [Console] always use stty when possible to ask hidden questions
2020-07-03 20:04:21 +02:00
Nicolas Grekas
b3df84c857 minor #37470 [Workflow] Normalize workflow changelog (lyrixx)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Workflow] Normalize workflow changelog

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

Commits
-------

e1de806050 [Workflow] Normalize workflow changelog
2020-07-03 14:54:52 +02:00
Nicolas Grekas
842a793f7d minor #37483 [PropertyAccess] Remove inflector component (gmponos)
This PR was merged into the 5.1 branch.

Discussion
----------

[PropertyAccess] Remove inflector component

Remove inflector component as a requirements since the component is deprecated.

| Q             | A
| ------------- | ---
| Branch?       | 5.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| License       | MIT

I hope I didn't miss something. I could not find a use of inflector component inside the PropertyAccess component and the inflector contains only one class that is deprecated

Commits
-------

8942d5a5b8 [PropertyAccess] Remove inflector component
2020-07-03 14:38:37 +02:00
Nicolas Grekas
ee0e37b47d bug #37486 [HttpClient] fix parsing response headers in CurlResponse (nicolas-grekas)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient] fix parsing response headers in CurlResponse

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

This fixes rare notices that look like:
`Argument 2 passed to Symfony\Component\HttpClient\Chunk\DataChunk::__construct() must be of the type string, null given`

I'm unable to provide a test case since I'm unable to provide a simple reproducer.

It happens that curl can call the header-function with multiple lines at once apparently, while most of the time it does so with one at a time.

Commits
-------

eb70fb2f26 [HttpClient] fix parsing response headers in CurlResponse
2020-07-03 14:36:03 +02:00
Nicolas Grekas
f0243822cb bug #37484 [HttpClient][CurlHttpClient] Fix http_version option usage (fancyweb)
This PR was merged into the 4.4 branch.

Discussion
----------

[HttpClient][CurlHttpClient] Fix http_version option usage

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/issues/37402
| License       | MIT
| Doc PR        | -

Ref https://github.com/symfony/symfony/pull/36422

If the scheme is https, we should only set http version 2.0 if the http_version is not specified.

Commits
-------

2676902a77 [HttpClient][CurlHttpClient] Fix http_version option usage
2020-07-03 13:44:51 +02:00
Thomas Calvet
2676902a77 [HttpClient][CurlHttpClient] Fix http_version option usage 2020-07-03 13:44:40 +02:00
Nicolas Grekas
eb70fb2f26 [HttpClient] fix parsing response headers in CurlResponse 2020-07-03 13:27:27 +02:00
Mponos George
8942d5a5b8
[PropertyAccess] Remove inflector component
[PropertyAccess] Remove inflector component as a requirements since the component is deprecated.
2020-07-03 10:49:29 +03:00
Fabien Potencier
98e6a93d0d feature #37482 [HttpClient] always yield a LastChunk in AsyncResponse on destruction (nicolas-grekas)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[HttpClient] always yield a LastChunk in AsyncResponse on destruction

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

This ensures that async decorators always "see" the destruction of an AsyncResponse, via an `isLast()` chunk + a "canceled" state.

[The diff](https://github.com/symfony/symfony/pull/37482/files?w=1) is hard to read, here are the hints to understand what changed:
- a __destructor has been added;
- the passthru logic has been moved to a new method but is essentially unchanged.

Commits
-------

3a4a58385e [HttpClient] always yield a LastChunk in AsyncResponse on destruction
2020-07-03 08:30:21 +02:00
Nicolas Grekas
3a4a58385e [HttpClient] always yield a LastChunk in AsyncResponse on destruction 2020-07-02 21:33:50 +02:00
David Maicher
d057dffcd6 [Mime] allow non-ASCII characters in local part of email 2020-07-01 19:26:13 +02:00
Nicolas Grekas
659699b9ce Merge branch '3.4' into 4.4
* 3.4:
  [Console] Do not check for "stty" using "exec" if that function is disabled
2020-07-01 19:14:21 +02:00
Nicolas Grekas
9f6acd549c minor #37466 [Console] Do not check for "stty" using "exec" if that function is disabled (mvorisek)
This PR was squashed before being merged into the 3.4 branch.

Discussion
----------

[Console] Do not check for "stty" using "exec" if that function is disabled

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

fixes https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/5030

Commits
-------

02124b6b3b [Console] Do not check for "stty" using "exec" if that function is disabled
2020-07-01 19:13:59 +02:00
Michael Voříšek
02124b6b3b [Console] Do not check for "stty" using "exec" if that function is disabled 2020-07-01 19:13:52 +02:00
Nicolas Grekas
ad94b395d0 bug #37472 [TwigBundle] Fix translator argument for twig.extension.trans (welcoMattic)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[TwigBundle] Fix translator argument for twig.extension.trans

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

I fixed the Translator service argument for Translation Twig Extension, which was a bit hard to debug, because of `nullOnInvalid` and the anonymous class created in the Extension if Translator is null (https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php#L50).

Commits
-------

1cb35c0f7d [TwigBundle] Fix translator argument for twig.extension.trans
2020-07-01 19:12:11 +02:00
Nicolas Grekas
055b605e30 [Console] always use stty when possible to ask hidden questions 2020-07-01 17:27:01 +02:00
Mathieu Santostefano
1cb35c0f7d
[TwigBundle] Fix translator argument for twig.extension.trans 2020-07-01 17:01:32 +02:00
Fabien Potencier
8cc90b9845 feature #36364 [HttpKernel][WebProfilerBundle] Add session profiling (mtarld)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[HttpKernel][WebProfilerBundle] Add session profiling

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

This PR proposes to add session profiling.
It provides stateless checking status and session usage backtraces.

Under are screesnhots of provided profiling:
![Screenshot from 2020-04-06 13-42-41](https://user-images.githubusercontent.com/4955509/78581189-d6c32580-7833-11ea-9de5-d1e4f8e60c27.png)
![Screenshot from 2020-04-06 13-43-04](https://user-images.githubusercontent.com/4955509/78581193-d88ce900-7833-11ea-90a4-85d07c64d47e.png)
![Screenshot from 2020-04-06 17-43-17](https://user-images.githubusercontent.com/4955509/78581159-cca12700-7833-11ea-98d2-38306ec9ea37.png)
![Screenshot from 2020-04-06 17-43-35](https://user-images.githubusercontent.com/4955509/78581238-e8a4c880-7833-11ea-89e2-ff4fdea8dce5.png)

Commits
-------

5dbaef8883 Add session profiling
2020-07-01 16:42:25 +02:00
Grégoire Pineau
e1de806050 [Workflow] Normalize workflow changelog 2020-07-01 15:44:40 +02:00
Mathias Arlaud
5dbaef8883 Add session profiling 2020-07-01 14:40:41 +02:00
Fabien Potencier
5b6139f488 feature #37428 [Workflow] Added Function (and Twig extension) to retrieve a specific transition (Carlos Pereira De Amorim)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Workflow] Added Function (and Twig extension) to retrieve a specific transition

You can now easily retrieve a specific transition. Useful when you want the metadata of a specific transition.

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | hmmmm, should I create a ticket first ?
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/13907

I needed to get the metadata of a transition, but in order to do that, you need the transition object. So here is a PR to easily get the transition object

Commits
-------

0eebe74259 [Workflow] Added Function (and Twig extension) to retrieve a specific transition
2020-07-01 14:24:19 +02:00
Carlos Pereira De Amorim
0eebe74259 [Workflow] Added Function (and Twig extension) to retrieve a specific transition 2020-07-01 14:24:18 +02:00
Fabien Potencier
d8082fa2f8 feature #36487 [HttpClient] Add MockResponse::getRequestMethod() and getRequestUrl() to allow inspecting which request has been sent (javespi)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[HttpClient] Add MockResponse::getRequestMethod() and getRequestUrl() to allow inspecting which request has been sent

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | -  <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | - <!-- 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/releases):
 - Always add tests and ensure they pass.
 - Never break backward compatibility (see https://symfony.com/bc).
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too.)
 - Features and deprecations must be submitted against branch master.
-->

---

As same as the `MockResponse` class has `getRequestOptions()` when doing a request; I've added:
* `getRequestUrl()` - returns the URL used when doing the request
* `getRequestMethod()` - returns the HTTP method used when doing the request

With these two getters, we would be able to assert that the method and URL passed to the `HttpClient` were well generated. I've tried to assert the URL generated in a unit test of a class with a `SymfonyHttpClient` injected and it wasn't possible. Calling `$mock->getInfo('url')` returns `null`.

Example, if we have a class with `HttpClientInterface` injected like this:

```php
final class SymfonyHttpUserClient
{
    private HttpClientInterface $httpClient;
    private string $baseUri;

    public function __construct(
        HttpClientInterface $httpClient,
        string $baseUri
    ) {
        $this->httpClient = $httpClient;
        $this->baseUri = $baseUri;
    }

    public function getById(string $userId): void
    {
        $this->httpClient->request(
            'GET',
            $this->baseUri . $customerId
        );
    }
}
```

And if we want to do a unit test of `SymfonyHttpUserClient` right now we are not able to check if the URL of the request was well-formed passing a `MockResponse`. Also, we weren't able to assert the HTTP method (maybe this piece is not so critical to assert in the unit test).

```php
class SymfonyHttpUserClientTests extends TestCase
{
    public function testGetById(): void
    {
        $baseUri = 'https://user-api.test/api/v1/users/';
        $mockResponse = new MockResponse();
        $symfonyHttpUserClient = new SymfonyHttpUserClient(
            new MockHttpClient(
                [$mockResponse],
                $baseUri
            ),
            $baseUri
        );

        // test get by id:
        $symfonyHttpUserClient->getById('some-user-id');

        // cannot be asserted right now:
        $this->assertSame($mockResponse->getInfo('url'), $baseUri . 'some-user-id'); // fail
        $this->assertSame($mockResponse->getInfo('http_method'), 'GET'); // fail

        // it could be with the new getters:
        $this->assertSame($mockResponse->getRequestUrl(), $baseUri . 'some-user-id');
        $this->assertSame($mockResponse->getRequestMethod(), 'GET');
    }
}
```

This only happens if the class has injected the HttpClient and if it is used inside void methods with no being able to return the response. If the class returns the response, `url` and `http_method` are available with `$response->getInfo()` call. But this response object is a new one, is not the mock passed by argument when you instance the MockHttpClient.

Var dumps of `getInfo` array:

```
$response->getInfo() from MockClient:

..array(10) {
  ["start_time"]=>
  float(1587109014.7985)
  ["user_data"]=>
  NULL
  ["http_code"]=>
  int(200)
  ["response_headers"]=>
  array(0) {
  }
  ["error"]=>
  NULL
  ["canceled"]=>
  bool(false)
  ["redirect_count"]=>
  int(0)
  ["redirect_url"]=>
  NULL
  ["http_method"]=>
  string(3) "GET"
  ["url"]=>
  string(47) "https://user-api.test/api/v1/users/some-user-id"
}

$mock->getInfo()

array(4) {
  ["http_code"]=>
  int(200)
  ["response_headers"]=>
  array(0) {
  }
  ["error"]=>
  NULL
  ["canceled"]=>
  bool(false)
}
```

This is a minor change, I opened the PR with `4.4` as base branch; but not sure if it should be opened with `5.0` as base branch or even `master` taking account is a feature (add two new getters in MockResponse class). Let me know if I didn't follow right the instructions (first PR on Symfony project 😃)

Thanks!

Commits
-------

7a250d80c1 [HttpClient] Add MockResponse::getRequestMethod() and getRequestUrl() to allow inspecting which request has been sent
2020-07-01 14:18:06 +02:00
Fabien Potencier
501542a0dd feature #37295 Move event alias mappings to their components (derrabus)
This PR was merged into the 5.2-dev branch.

Discussion
----------

Move event alias mappings to their components

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

For a small console tool, I wanted to use the Console, EventDispatcher and DI components standalone. In order to make use of aliased events, I had to copy over the mapping information from FrameworkBundle, which was a bit unfortunate.

With this PR, I'd like to suggest to store all alias mappings on the `*Events` classes of each component instead. This change will make the mapping reusable outside of the full-stack framework.

Note: I've bumped the dependencies of FrameworkBundle/SercurityBundle in order to gain access to the moved mapping information. If any of the bumps is too heavy, please tell me and I'll implement a fallback instead.

Commits
-------

28e6f6f72c Move event alias mappings to their components.
2020-07-01 14:12:45 +02:00
YaFou
4288df4f74
[Console] Fixes question input encoding on Windows 2020-07-01 11:10:10 +02:00
Nicolas Grekas
c2e2560657 fix merge 2020-06-30 20:21:22 +02:00
Nicolas Grekas
1a3979a412 Merge branch '5.1'
* 5.1:
  [Bridge/Twig] Relax tests
2020-06-30 19:59:55 +02:00
Nicolas Grekas
d51e8d534e Merge branch '5.0' into 5.1
* 5.0:
  [Bridge/Twig] Relax tests
2020-06-30 19:59:51 +02:00
Nicolas Grekas
5c056c18fc Merge branch '4.4' into 5.0
* 4.4:
  [Bridge/Twig] Relax tests
2020-06-30 19:59:45 +02:00
Nicolas Grekas
b9354dc62f Merge branch '3.4' into 4.4
* 3.4:
  [Bridge/Twig] Relax tests
2020-06-30 19:59:39 +02:00
Nicolas Grekas
91f30e0b62 [Bridge/Twig] Relax tests 2020-06-30 19:58:38 +02:00
Nicolas Grekas
1bbfde581f Merge branch '5.1'
* 5.1:
  [ErrorHandler] fix throwing from __toString()
  Removed comments and requirements relative to php <5.5 (not supported anymore)
  Fix caching of parent locales file in translator
  fix validating lazy properties that evaluate to null
2020-06-30 19:42:41 +02:00
Nicolas Grekas
85d471bf05 Merge branch '5.0' into 5.1
* 5.0:
  [ErrorHandler] fix throwing from __toString()
  Removed comments and requirements relative to php <5.5 (not supported anymore)
  Fix caching of parent locales file in translator
  fix validating lazy properties that evaluate to null
2020-06-30 19:42:22 +02:00
Nicolas Grekas
23fcbd4dd5 Merge branch '4.4' into 5.0
* 4.4:
  [ErrorHandler] fix throwing from __toString()
  Removed comments and requirements relative to php <5.5 (not supported anymore)
  Fix caching of parent locales file in translator
  fix validating lazy properties that evaluate to null
2020-06-30 19:40:59 +02:00
Nicolas Grekas
450034c986 Merge branch '3.4' into 4.4
* 3.4:
  [ErrorHandler] fix throwing from __toString()
  Removed comments and requirements relative to php <5.5 (not supported anymore)
  fix validating lazy properties that evaluate to null
2020-06-30 19:40:09 +02:00
Nicolas Grekas
52ddce1a74 bug #37447 [Validator] fix validating lazy properties that evaluate to null (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] fix validating lazy properties that evaluate to null

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

Commits
-------

776daf28b4 fix validating lazy properties that evaluate to null
2020-06-30 19:35:43 +02:00
Nicolas Grekas
034be4415c bug #37464 [ErrorHandler] fix throwing from __toString() (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[ErrorHandler] fix throwing from __toString()

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

Commits
-------

aeb4637341 [ErrorHandler] fix throwing from __toString()
2020-06-30 19:29:43 +02:00
Nicolas Grekas
aeb4637341 [ErrorHandler] fix throwing from __toString() 2020-06-30 19:28:29 +02:00
Javier Espinosa
7a250d80c1 [HttpClient] Add MockResponse::getRequestMethod() and getRequestUrl() to allow inspecting which request has been sent 2020-06-30 18:39:01 +02:00
Nicolas Grekas
187b66bb40 minor #35959 [VarDumper] improve rendering HTML (ln-dim)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[VarDumper] improve rendering HTML

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

I improved the rendering so that HtmlDumper makes a decision on which element should be rendered compacted/expanded in PHP, not JavaScript.

Commits
-------

0a4ef897b7 [VarDumper] improve rendering HTML
2020-06-30 16:44:03 +02:00
Dmitrii Lozhkin
0a4ef897b7 [VarDumper] improve rendering HTML 2020-06-30 16:43:42 +02:00
Alexander M. Turek
28e6f6f72c Move event alias mappings to their components. 2020-06-30 16:13:44 +02:00