Commit Graph

42906 Commits

Author SHA1 Message Date
Christian Flothmann a1de01c6ff Merge branch '4.2' into 4.3
* 4.2:
  fix Debug component dependencies
  [travis] not all components have a master branch
2019-06-28 14:12:54 +02:00
Tobias Schultze efaecbf9d1 minor #32246 [Routing] Deprecate RouteCollection::addPrefix(null) (derrabus)
This PR was merged into the 4.4 branch.

Discussion
----------

[Routing] Deprecate RouteCollection::addPrefix(null)

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

This PR deprecates the undocumented possibility to pass `null` as prefix to `RouteCollection::addPrefix()`. This allows us to add a `string` type-hint on the parameter in 5.0, see https://github.com/symfony/symfony/pull/32181#discussion_r298419954

/cc @Tobion

Commits
-------

2a88752cd6 [Routing] Deprecate RouteCollection::addPrefix(null).
2019-06-28 14:04:32 +02:00
Christian Flothmann 5edac837a0 Merge branch '3.4' into 4.2
* 3.4:
  fix Debug component dependencies
  [travis] not all components have a master branch
2019-06-28 14:00:38 +02:00
Alexander M. Turek d5bc28ad20 [DependencyInjection] Added type-hints on compiler passes. 2019-06-28 14:00:06 +02:00
Nicolas Grekas 2bab37d64f bug #32206 Catch JsonException and rethrow in JsonEncode (phil-davis)
This PR was merged into the 3.4 branch.

Discussion
----------

Catch JsonException and rethrow in JsonEncode

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | adjustment to implementation of previous PRs for issue #31447
| License       | MIT
| Doc PR        | not applicable

PR #31860 provided handling of PHP  7.3 `JSON_THROW_ON_ERROR` behavior in the various `JsonEncode` and related classes/methods.

PR #31869 adjusted that. In particular, it adjusted ` src/Symfony/Component/Serializer/Encoder/JsonDecode.php` so that it catches any `JsonException` and re-throws it as `NotEncodableValueException`. That preserves the previous behavior of `JsonDecode:decode` - it always throws `NotEncodableValueException` when something goes wrong.

IMO `JsonEncode:encode` needs the same logic. At the moment, if a caller specifies `JSON_THROW_ON_ERROR` then the method can throw `JsonException`, but actually the "standard" for `JsonEncode:encode` is that it throws `NotEncodableValueException`

Adjust `JsonEncode:encode` to catch `JsonException` and rethrow it as `NotEncodableValueException`

Commits
-------

9c76790ee8 Catch JsonException and rethrow in JsonEncode
2019-06-28 13:57:22 +02:00
Nicolas Grekas 9c668d9282 minor #32213 [HttpKernel] Add @method PHPDoc for getRequest and getResponse back to Client (teohhanhui)
This PR was merged into the 4.3 branch.

Discussion
----------

[HttpKernel] Add @method PHPDoc for getRequest and getResponse back to Client

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

As the deprecated `Symfony\Component\HttpKernel\Client` does not extend `Symfony\Component\HttpKernel\HttpKernelBrowser`, it has not retained the correct PHPDoc from before.

The order of inheritance was changed in https://github.com/symfony/symfony/pull/31881, but the PHPDoc was never restored.

Commits
-------

332135186a [HttpKernel] Add @method PHPDoc for getRequest and getResponse back to Client
2019-06-28 13:56:05 +02:00
Nicolas Grekas 8477f2b942 minor #32248 fix Debug component dependencies (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

fix Debug component dependencies

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

Commits
-------

87fe077a89 fix Debug component dependencies
2019-06-28 13:37:40 +02:00
Christian Flothmann 9000c1eab4 remove invalid test case 2019-06-28 12:20:30 +02:00
Christian Flothmann d1261e78a4 remove invalid test cases 2019-06-28 12:15:37 +02:00
Grégoire Pineau 379bbee370 [Serializer] Fixed PHP of DenormalizableInterface::denormalize
It can return an array of objects
2019-06-28 11:46:25 +02:00
Christian Flothmann 87fe077a89 fix Debug component dependencies 2019-06-28 11:18:39 +02:00
Alexander M. Turek 2a88752cd6 [Routing] Deprecate RouteCollection::addPrefix(null). 2019-06-28 10:23:33 +02:00
Nicolas Grekas 5d55b91fae [Cache] work aroung PHP memory leak 2019-06-28 10:22:31 +02:00
smoench 02ee4d0b05
[Finder] docblock fixes 2019-06-28 10:02:59 +02:00
Christian Flothmann 901fe0d7c5 pass error code as a string 2019-06-28 09:33:32 +02:00
Fabien Potencier a25848b2b5 Merge branch '4.4'
* 4.4:
  [ErrorCatcher] some cleanup and better doc
2019-06-28 07:53:21 +02:00
Fabien Potencier 7f6ed32a1d bug #32232 [ErrorCatcher] some cleanup and better doc (Tobion)
This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorCatcher] some cleanup and better doc

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

Commits
-------

a609f57c03 [ErrorCatcher] some cleanup and better doc
2019-06-28 07:52:45 +02:00
Jan Schädlich b26b37dffc [OptionResolver] Add type-hints to OptionResolver class 2019-06-27 23:14:10 +02:00
Jan Schädlich fe3b165354 [PropertyInfo] Add type-hints to public interfaces and classes 2019-06-27 22:40:09 +02:00
Tobias Schultze a609f57c03 [ErrorCatcher] some cleanup and better doc 2019-06-27 22:36:35 +02:00
Nicolas Grekas 1d57b800aa fix merge 2019-06-27 21:25:51 +02:00
Fabien Potencier 3e54cb71de Merge branch '4.4'
* 4.4:
  deprecated FlattenException::create()
  [ErrorHandler] made IDEs and static analysis tools happy
2019-06-27 20:22:01 +02:00
Fabien Potencier b92e4ed9d4 feature #32221 [ErrorCatcher] Make IDEs and static analysis tools happy (fabpot)
This PR was squashed before being merged into the 4.4 branch (closes #32221).

Discussion
----------

[ErrorCatcher] Make IDEs and static analysis tools happy

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

f511bc5ff6 deprecated FlattenException::create()
7dd9dbf28d [ErrorHandler] made IDEs and static analysis tools happy
2019-06-27 20:20:54 +02:00
Fabien Potencier bef96ee884 Merge branch '4.4'
* 4.4:
  renamed the ErrorHandler component to ErrorCatcher
2019-06-27 19:56:41 +02:00
Fabien Potencier f511bc5ff6 deprecated FlattenException::create() 2019-06-27 19:51:41 +02:00
Fabien Potencier 7dd9dbf28d [ErrorHandler] made IDEs and static analysis tools happy 2019-06-27 19:50:32 +02:00
Fabien Potencier 45526a18c6 feature #32227 Rename the ErrorHandler component to ErrorCatcher (fabpot)
This PR was merged into the 4.4 branch.

Discussion
----------

Rename the ErrorHandler component to ErrorCatcher

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

b6eac3f861 renamed the ErrorHandler component to ErrorCatcher
2019-06-27 19:49:04 +02:00
Fabien Potencier b6eac3f861 renamed the ErrorHandler component to ErrorCatcher 2019-06-27 19:38:50 +02:00
julien57 44e5b0b6e7 removed return values 2019-06-27 19:10:13 +02:00
Nicolas Grekas 7f7c142a3b Merge branch '4.4'
* 4.4:
  [Mailer] fixed tests on Windows
  [PhpUnitBridge] fix tests
  [Mailer] fixed error message when connecting to a stream raises an error before connect()
  [Mailer] fixed timeout type hint
  improve error messages in the event dispatcher
  [Security/Core] work around sodium_compat issue
  bumped Symfony version to 4.3.3
  updated VERSION for 4.3.2
  updated CHANGELOG for 4.3.2
  bumped Symfony version to 4.2.11
  updated VERSION for 4.2.10
  updated CHANGELOG for 4.2.10
  bumped Symfony version to 3.4.30
  updated VERSION for 3.4.29
  update CONTRIBUTORS for 3.4.29
  updated CHANGELOG for 3.4.29
  Fixed type annotation.
2019-06-27 18:53:23 +02:00
Fabien Potencier 4d8c473fd3 Merge branch '4.3' into 4.4
* 4.3:
  [Mailer] fixed tests on Windows
  [PhpUnitBridge] fix tests
  [Mailer] fixed error message when connecting to a stream raises an error before connect()
  [Mailer] fixed timeout type hint
  improve error messages in the event dispatcher
  [Security/Core] work around sodium_compat issue
  bumped Symfony version to 4.3.3
  updated VERSION for 4.3.2
  updated CHANGELOG for 4.3.2
  bumped Symfony version to 4.2.11
  updated VERSION for 4.2.10
  updated CHANGELOG for 4.2.10
  bumped Symfony version to 3.4.30
  updated VERSION for 3.4.29
  update CONTRIBUTORS for 3.4.29
  updated CHANGELOG for 3.4.29
  Fixed type annotation.
2019-06-27 18:48:03 +02:00
Fabien Potencier 00e13677ba minor #32228 [Mailer] fix tests on Windows (fabpot)
This PR was merged into the 4.3 branch.

Discussion
----------

[Mailer] fix tests on Windows

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

90f61e9efa [Mailer] fixed tests on Windows
2019-06-27 18:47:10 +02:00
Fabien Potencier 90f61e9efa [Mailer] fixed tests on Windows 2019-06-27 18:29:52 +02:00
Fabien Potencier d18fd01c39 minor #32225 [PhpUnitBridge] fix tests (nicolas-grekas)
This PR was merged into the 4.3 branch.

Discussion
----------

[PhpUnitBridge] fix tests

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

The bridge reads $_SERVER/$_ENV  now.

Commits
-------

9b69dc651a [PhpUnitBridge] fix tests
2019-06-27 18:26:18 +02:00
Fabien Potencier bcc66e3400 minor #32226 [travis] not all components have a master branch (nicolas-grekas)
This PR was merged into the 3.4 branch.

Discussion
----------

[travis] not all components have a master branch

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

Commits
-------

b73025a4c6 [travis] not all components have a master branch
2019-06-27 18:19:56 +02:00
Nicolas Grekas b73025a4c6 [travis] not all components have a master branch 2019-06-27 18:11:56 +02:00
Nicolas Grekas 9b69dc651a [PhpUnitBridge] fix tests 2019-06-27 18:09:32 +02:00
Fabien Potencier e13309c3f8 Merge branch '4.4'
* 4.4:
  made BuferringLogger classes internal and final
  Added ErrorHandler component
2019-06-27 16:24:50 +02:00
Fabien Potencier acd7bd679b bug #32219 Make BuferringLogger classes internal and final (fabpot)
This PR was merged into the 4.4 branch.

Discussion
----------

Make BuferringLogger classes internal and final

| 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? | 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
| License       | MIT
| Doc PR        | n/a

The `BufferingLogger` classes are internal code that nobody should use directly. Let's make it clear.

Commits
-------

7dd391ed97 made BuferringLogger classes internal and final
2019-06-27 15:38:11 +02:00
Fabien Potencier 7dd391ed97 made BuferringLogger classes internal and final 2019-06-27 15:21:55 +02:00
Fabien Potencier 13a5e2dd1f feature #31065 Add ErrorHandler component (yceruto)
This PR was merged into the 4.4 branch.

Discussion
----------

Add ErrorHandler component

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

Mainly for API-based apps that don't require TwigBundle to get the correct exception response according to the request format (aka `_format` attribute).

![exception_response](https://user-images.githubusercontent.com/2028198/55509651-713dc700-562a-11e9-8b98-bef3b0229397.gif)

✔️ [RFC7807](https://tools.ietf.org/html/rfc7807) compliant for JSON and XML formats.

---

This introduce a new `ErrorRenderer` service that render a `FlattenException` into a given format:
```php
use Symfony\Component\ErrorHandler\ErrorRenderer\ErrorRenderer;
use Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer;
use Symfony\Component\ErrorHandler\ErrorRenderer\JsonErrorRenderer;

$renderers = [
    new HtmlErrorRenderer(),
    new JsonErrorRenderer(),
    // ...
];
$errorRenderer = new ErrorRenderer($renderers);

return new Response(
    $errorRenderer->render($exception, $request->getRequestFormat()),
    $exception->getStatusCode(),
    $exception->getHeaders()
);
```

The built-in error renderers are:

| Format | Class |
| --- | --- |
| html | HtmlErrorRenderer |
| json | JsonErrorRenderer |
| xml, atom | XmlErrorRenderer |
| txt | TxtErrorRenderer |

And you can add your own error renderer by implementing the `ErrorRendererInterface` and tagging it with `error_handler.renderer` in your service definition.

Creating your own error renderer for a built-in format will end up replacing the related built-in error renderer.

Demo: https://github.com/yceruto/error-handler-app ([add custom error renderer](06fc647841))

Commits
-------

7057244890 Added ErrorHandler component
2019-06-27 14:40:37 +02:00
Fabien Potencier f2f7fb4cf2 bug #32211 [Mailer] Fix error message when connecting to a stream raises an error before connect() (fabpot)
This PR was merged into the 4.3 branch.

Discussion
----------

[Mailer] Fix error message when connecting to a stream raises an error before connect()

| 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 | see https://github.com/swiftmailer/swiftmailer/issues/1201
| License       | MIT
| Doc PR        | n/a

According to the PHP docs, "If the value returned in errno is 0 and the function returned FALSE, it is an indication that the error occurred before the connect() call.".

Using the `@` operator means that we get a generic error message without any clues about why connection cannot be done. Using an error handler allows to get the real issue.

Commits
-------

eb15bffa78 [Mailer] fixed error message when connecting to a stream raises an error before connect()
2019-06-27 13:12:59 +02:00
Teoh Han Hui 332135186a
[HttpKernel] Add @method PHPDoc for getRequest and getResponse back to Client 2019-06-27 12:01:44 +02:00
Fabien Potencier eb15bffa78 [Mailer] fixed error message when connecting to a stream raises an error before connect() 2019-06-27 11:33:25 +02:00
Fabien Potencier 791a2127aa bug #32210 [Mailer] Fix timeout type hint (fabpot)
This PR was merged into the 4.3 branch.

Discussion
----------

[Mailer] Fix timeout type hint

| 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 | n/a
| License       | MIT
| Doc PR        | n/a

The timeout on a socket is a float, not an integer.

Commits
-------

0e7ed9e45c [Mailer] fixed timeout type hint
2019-06-27 11:07:55 +02:00
Fabien Potencier 0e7ed9e45c [Mailer] fixed timeout type hint 2019-06-27 10:51:02 +02:00
Fabien Potencier e55978ada8 bug #32199 [EventDispatcher] improve error messages in the event dispatcher (xabbuh)
This PR was merged into the 4.3 branch.

Discussion
----------

[EventDispatcher] improve error messages in the event dispatcher

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

Commits
-------

0b381dbe1d improve error messages in the event dispatcher
2019-06-27 09:31:09 +02:00
Christian Flothmann 0b381dbe1d improve error messages in the event dispatcher 2019-06-27 08:42:14 +02:00
Phil Davis 9c76790ee8 Catch JsonException and rethrow in JsonEncode 2019-06-27 10:07:28 +05:45
Nicolas Grekas 1985a5cc13 Merge branch '4.2' into 4.3
* 4.2:
  [Security/Core] work around sodium_compat issue
  bumped Symfony version to 4.2.11
  updated VERSION for 4.2.10
  updated CHANGELOG for 4.2.10
  bumped Symfony version to 3.4.30
  updated VERSION for 3.4.29
  update CONTRIBUTORS for 3.4.29
  updated CHANGELOG for 3.4.29
2019-06-26 20:29:07 +02:00