Commit Graph

50245 Commits

Author SHA1 Message Date
Alexander M. Turek
8bd861bbc6 [Console] The message of "class not found" errors has changed in php 8. 2020-08-08 21:42:49 +02:00
Alexander M. Turek
8b801c1269 The PHPUnit\Util\XML class has been removed in PHPUnit 9.3. 2020-08-08 21:12:02 +02:00
Alexander M. Turek
cdd727a93b
[PhpUnitBridge] Fix assertDoesNotMatchRegularExpression() polyfill. 2020-08-08 20:25:28 +02:00
Alexander M. Turek
67102c32e6 [Console] Make sure we pass a numeric array of arguments to call_user_func_array(). 2020-08-08 17:34:42 +02:00
Fabien Potencier
02582008a7 minor #37764 Remove outdated references from base_js.html.twig file (Chi-teck)
This PR was squashed before being merged into the 5.1 branch.

Discussion
----------

Remove outdated references from base_js.html.twig file

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

It looks like TwigBundle/Resources/views/base_js.html.twig file has been removed.

Commits
-------

65fe98ec66 Remove outdated references from base_js.html.twig file
2020-08-08 16:42:43 +02:00
Chi-teck
65fe98ec66 Remove outdated references from base_js.html.twig file 2020-08-08 16:42:38 +02:00
Fabien Potencier
a8ea11b419 bug #37770 [String] We cannot have a "provides" function in test cases (derrabus)
This PR was merged into the 5.1 branch.

Discussion
----------

[String] We cannot have a "provides" function in test cases

| Q             | A
| ------------- | ---
| Branch?       | 5.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Part of #37564
| License       | MIT
| Doc PR        | N/A

Because of a change in PHPUnit 9.3 (see sebastianbergmann/phpunit#3936), we cannot have define a method named `provides` in test cases. And since php is case-insensitive regarding method calls, the method `provideS` used by the String component's `FunctionTest` will cause a fatal error. I have renamed it to work around that issue.

cc @fancyweb

Commits
-------

46e2a0c517 [String] We cannot have a "provides" function in test cases.
2020-08-08 16:27:45 +02:00
Alexander M. Turek
46e2a0c517 [String] We cannot have a "provides" function in test cases. 2020-08-08 15:51:54 +02:00
mihail.krasilnikov
3ba8d8f135 [Notifier] added telegram options 2020-08-07 22:08:56 +03:00
Christian Flothmann
235920a388 fix mapping errors from unmapped forms 2020-08-07 15:17:26 +02:00
Fabien Potencier
5e02d86074 Fix CS 2020-08-07 10:44:47 +02:00
Fabien Potencier
7520884bc2 feature #35773 [Notifier] Change notifier recipient handling (jschaedl)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Notifier] Change notifier recipient handling

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #35558 <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | tbd.

According to @wouterj's reasoning in #35558 I did the following to merge the `AdminRecipient` with the `Recipient` class:

- introduced a `EmailRecipientInterface` with `getEmail(): string` methods
- introduced a `RecipientInterface` that is extended by `EmailRecipientInterface` and `SmsRecipientInterface`
- changed `Recipient` class which now holds an email and a phone number property and implements the `EmailRecipientInterface` and the `SmsRecipientInterface`
- changed `NoRecipient` class which now implements the `RecipientInterface`
- removed the `AdminRecipient` and fixed all related type-hints
- introduced an `EmailRecipient` and `SmsRecipient`
- changed the type-hint of the `$recipient` argument in `NotifierInterface::send()`, `Notifier::getChannels()`, `ChannelInterface::notifiy()` and `ChannelInterface::supports()` to `RecipientInterface`
- changed the type hint of the `$recipient` argument in the `as*Message()` of the  `EmailNotificationInterface` and `SmsNotificationInterface` which now uses the introduced interfaces
- changed the type hint of the `$recipient` argument in the static `fromNotification()` factory methods in `EmailMessage` and `SmsMessage` which now uses the introduced interfaces
- changed `EmailChannel` to only support recipients which implement the `EmailRecipientInterface`
- changed `SmsChannel` only supports recipients which implement the `SmsRecipientInterface`

Commits
-------

588607bdd1 [Notifier] Change notifier recipient handling
2020-08-07 10:44:01 +02:00
Jan Schädlich
588607bdd1 [Notifier] Change notifier recipient handling 2020-08-07 10:43:53 +02:00
Fabien Potencier
669b3dfd42 feature #36488 [Notifier] Add Google Chat bridge (GromNaN)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Notifier] Add Google Chat bridge

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #35875
| License       | MIT
| Doc PR        | symfony/symfony-docs#14018

Uses the webhook to send messages.
```php
$transport = (new GoogleChatTransportFactory())
    ->create(Dsn::fromString('googlechat://<key>:<token>@default/<space>?threadKey=<thread>'));
```

The `threadKey` can be any string, it allows to post all messages to the same thread instead of creating a new thread for each message.

Example of notification for exceptions:
![image](https://user-images.githubusercontent.com/400034/79625049-7a5ee080-8126-11ea-9216-588309642bd3.png)

Commits
-------

c4cda758b5 [Notifier] Add Google Chat bridge
2020-08-07 08:31:51 +02:00
Jérôme TAMARELLE
c4cda758b5 [Notifier] Add Google Chat bridge 2020-08-07 08:31:44 +02:00
noniagriconomie
0b0a1f6f8e Add days before expiration in "about" command 2020-08-06 11:34:29 +02:00
Fabien Potencier
e1cfbd20fe minor #37749 [Lock] downgrade log.info to log.debug (jderusse)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Lock] downgrade log.info to log.debug

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

This PR follows #37713 and reduce log verbosity in CombinedStore

Commits
-------

080f1149a1 Reduce log verbosity for CombinedStore
2020-08-06 11:33:23 +02:00
Jérémy Derussé
080f1149a1
Reduce log verbosity for CombinedStore 2020-08-06 10:03:26 +02:00
Fabien Potencier
1382001dfe minor #37741 Typo: somes styles fixed (Pyrrah)
This PR was submitted for the master branch but it was merged into the 5.1 branch instead.

Discussion
----------

Typo: somes styles fixed

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

Typo: somes styles fixed

Commits
-------

3703f1440e Typo: somes styles fixed
2020-08-06 09:00:30 +02:00
Pierre-Yves
3703f1440e Typo: somes styles fixed 2020-08-06 09:00:23 +02:00
Fabien Potencier
d66a0a76e2 feature #36692 [HttpClient] add EventSourceHttpClient to consume Server-Sent Events (soyuka)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[HttpClient] add EventSourceHttpClient to consume Server-Sent Events

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | na
| License       | MIT
| Doc PR        | symfony/symfony-docs#...

<details>
 <summary>First implementation</summary>
This patch implements the [w3c Server-Sent Events specification](https://www.w3.org/TR/eventsource/#eventsource) on top of symfony's http client. It provides an `EventSource` class that allows you to interact of server sent events.

Comparing to the Javascript implementation, we won't be able to use the same API. Indeed, in php listeners need to be setup before we connect to the HTTP stream.
I'm not fond of adding a dependency to EventDispatcher from HTTP Client, therefore I'm all ears if you have better solutions.
About event parsing, I wanted to avoid using regular expression and it uses smart data split. Note that I had to concatenate an internal buffer and only handle the data when a newline is found to cover long chunks. This is an alternative to this [react php eventsource](https://github.com/clue/reactphp-eventsource). Note that this implementation is closer to the specification in some cases that are still to be covered by tests (`retry`, `data:value` without space after colon is valid etc.).
</details>

This is an implementation of the [Server-Sent Events specification](https://html.spec.whatwg.org/multipage/server-sent-events.html) based on symfony's HTTP Client. After a few suggestions on the first implementation (see details above), I've implemented a chunk generator with this kind of API:

```php
$client = new EventSourceHttpClient($client, 10);
$source = $client->connect('GET', "http://localhost:8080/events");
while($source) {
    foreach ($client->stream($source, 2) as $r => $chunk) {
        if ($chunk->isTimeout()) {
            dump([
                'timeout' => [
                    'retry' => 1 + count($r->getInfo('previous_info') ?? [])
                ],
            ]);
            continue;
        }
        if ($chunk->isLast()) {
            dump([
                'eof' => [
                    'retries' => count($r->getInfo('previous_info') ?? [])
                ],
            ]);
            $source = null;
            return;
        }

        dump($chunk);
    }
}
```

TODO:
- [x] validate implementation (~~don't use EventDispatcher ?~~, need to be implemented as `stream` instead of `message`)
- [x] default timeout value
- [x] implement retry/reconnection
- [x] tests (do test with super long chunk, retry, bad http content-type response)
- [ ] update changelog
- [ ] document

Commits
-------

12ccca3cd4 [HttpClient] add EventSourceHttpClient to consume Server-Sent Events
2020-08-06 08:59:15 +02:00
soyuka
12ccca3cd4 [HttpClient] add EventSourceHttpClient to consume Server-Sent Events 2020-08-06 08:59:09 +02:00
Fabien Potencier
5e2abc66c2 Fix previous merge 2020-08-06 08:17:52 +02:00
Fabien Potencier
558dfa8c56 feature #36616 [Notifier] Add Zulip notifier bridge (phpfour)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Notifier] Add Zulip notifier bridge

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | See #33687
| License       | MIT
| Doc PR        | https://github.com/symfony/symfony-docs/pull/13604

This adds a [Zulip](https://zulipchat.com/) (another popular open source Slack alternative) transport for the new Notifier component.

#### Sample DSN

```ZULIP_DSN=zulip://test-bot@zulipchat.com:api-key@example.zulipchat.com?channel=builds```

#### Configuration

```yml
# config/packages/notifier.yaml
framework:
    notifier:
        chatter_transports:
            zulip: '%env(ZULIP_DSN)%'
```

#### Example

```php
public function index(ChatterInterface $chatter)
{
    $message = (new ChatMessage('New order arrived!', new ZulipOptions('Ordering')))
        ->transport('zulip');

    $chatter->send($message);

    ...
}
```

Commits
-------

bd4fd32121 Adds Zulip notifier bridge
2020-08-06 08:16:39 +02:00
Mohammad Emran Hasan
bd4fd32121 Adds Zulip notifier bridge 2020-08-06 08:16:18 +02:00
Fabien Potencier
b968497770 bug #37748 [Notifier] Fix SentMessage implementation (fabpot)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Notifier] Fix SentMessage implementation

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | n/a

#36611 broke the Notifier when used with Messenger.

/cc @jeremyFreeAgent

Commits
-------

92c28de41b [Notifier] Fix SentMessage implementation
2020-08-06 07:19:29 +02:00
Fabien Potencier
9db0f20c85 feature #37747 [Notifier] Make Freemobile config more flexible (fabpot)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Notifier] Make Freemobile config more flexible

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a<!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | n/a

As Freemobile only supports French phone numbers, let's support French numbers without the international code.

Commits
-------

4dfde6ae7c [Notifier] Make Freemobile config more flexible
2020-08-06 07:18:22 +02:00
Fabien Potencier
e43d6b3baf Merge branch '5.1'
* 5.1:
  fail properly when the required service is not defined
  Fix typo
  [Finder] Fix GitIgnore parser when dealing with (sub)directories and take order of lines into account
  Update UPGRADE-5.0.md
  Added the missing reset tag to mailer.logger_message_listener
  Fix invalid option sslmode
  Updated README for the Mailer component
  fix error with custom function and web profiler routing tab
2020-08-06 07:13:39 +02:00
Fabien Potencier
ea69524de9 Merge branch '4.4' into 5.1
* 4.4:
  fail properly when the required service is not defined
  Fix typo
  [Finder] Fix GitIgnore parser when dealing with (sub)directories and take order of lines into account
  Update UPGRADE-5.0.md
  Added the missing reset tag to mailer.logger_message_listener
  Updated README for the Mailer component
  fix error with custom function and web profiler routing tab
2020-08-06 07:08:30 +02:00
Fabien Potencier
d81eb081c3 bug #37729 [FrameworkBundle] fail properly when the required service is not defined (xabbuh)
This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] fail properly when the required service is not defined

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

Before:

```
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "mailer.logger_message_listener".
```

After:

```
A client must have Mailer enabled to make email assertions. Did you forget to require symfony/mailer?
```

Commits
-------

a16ebc177d fail properly when the required service is not defined
2020-08-06 07:03:59 +02:00
Fabien Potencier
92c28de41b [Notifier] Fix SentMessage implementation 2020-08-06 06:53:52 +02:00
Fabien Potencier
4dfde6ae7c [Notifier] Make Freemobile config more flexible 2020-08-06 06:52:01 +02:00
Gonzalo Vilaseca
81ca1f00a3 [HttpKernel] Provide status code in fragment handler exception 2020-08-04 11:02:58 +02:00
Fabien Potencier
995d784a0d bug #37701 [Serializer] Fix that it will never reach DOMNode (TNAJanssen)
This PR was squashed before being merged into the 3.4 branch.

Discussion
----------

[Serializer] Fix that it will never reach DOMNode

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

When providing the DOMNode object, the is_object check will return true. This way it will never reach the DOMNode check.

So i moved this check to above the is_object check.

Commits
-------

38787ac785 [Serializer] Fix that it will never reach DOMNode
2020-08-04 08:15:33 +02:00
Alexander Janssen
38787ac785 [Serializer] Fix that it will never reach DOMNode 2020-08-04 08:15:26 +02:00
Fabien Potencier
c0a707f0db feature #37718 [Security] class Security implements AuthorizationCheckerInterface (SimonHeimberg)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Security] class Security implements AuthorizationCheckerInterface

The class has the method of AuthorizationCheckerInterface already.

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       |  <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | <!-- required for new features -->

The class Security has the method for interface AuthorizationCheckerInterface already. By implementing the interface, Security can be passed to methods typehinted with AuthorizationCheckerInterface.

Commits
-------

cea6ebda5b [Security] class Security implements AuthorizationCheckerInterface
2020-08-04 08:13:57 +02:00
Fabien Potencier
f92b727f8a minor #37730 [Validator] sync translations (xabbuh)
This PR was merged into the 3.4 branch.

Discussion
----------

[Validator] sync translations

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

Commits
-------

b7d2b6042b [Validator] sync translations
2020-08-04 08:12:54 +02:00
Fabien Potencier
6d2ee19b60 Fix CS 2020-08-04 08:11:14 +02:00
Fabien Potencier
b94eb47396 feature #37732 [Console] Allow testing single command apps using CommandTester (chalasr)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Console] Allow testing single command apps using CommandTester

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

Commits
-------

63407d8201 [Console] Allow disabling auto-exit for single command apps
2020-08-04 08:10:23 +02:00
Fran Moreno
27bb1c499d Fix typehint phpdoc 2020-08-03 20:22:34 +02:00
Robin Chalas
63407d8201 [Console] Allow disabling auto-exit for single command apps 2020-08-03 17:23:43 +02:00
Christian Flothmann
b7d2b6042b [Validator] sync translations 2020-08-03 15:22:15 +02:00
Christian Flothmann
a16ebc177d fail properly when the required service is not defined 2020-08-03 15:05:59 +02:00
Fabien Potencier
2ddacad477 Fix typehint 2020-08-02 10:17:48 +02:00
Fabien Potencier
681c66675e feature #37480 [Messenger] add redeliveredAt in RedeliveryStamp construct (qkdreyer)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Messenger] add redeliveredAt in RedeliveryStamp construct

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

---

this would allows one to correctly unserialize a RedeliveryStamp with a custom serializer not using the php serialize function

Commits
-------

64d26836da [Messenger] add redeliveredAt in RedeliveryStamp construct
2020-08-02 10:17:01 +02:00
Quentin Dreyer
64d26836da [Messenger] add redeliveredAt in RedeliveryStamp construct 2020-08-02 10:16:56 +02:00
Fabien Potencier
4105e935ac minor #37669 [EventDispatcher] Minor: Avoid not needed null check in dispatch() (brainexe)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[EventDispatcher] Minor: Avoid not needed null check in dispatch()

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

Just found a not needed null check in the heavyly called EventDispatcher::dispatch() method - the $eventName get's always a string now - no null anymore, as it gets the class name instead.

Commits
-------

0d36c11f28 [EventDispatcher] Avoid not needed null check in dispatch()
2020-08-02 10:13:42 +02:00
Fabien Potencier
f76ac74b20 feature #37565 [Validator] Add Isin validator constraint (lmasforne)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Validator] Add Isin validator constraint

Co-Authored-By: Yannis Foucher <33806646+YaFou@users.noreply.github.com>

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #36362
| License       | MIT
| Doc PR        | symfony/symfony-docs#13960

Rebase of https://github.com/symfony/symfony/pull/36368

I asked him by mail and he didn't have time to finish the PR and allowed me to do it.

Commits
-------

8e1ffc8b99 Feature #36362 add Isin validator constraint
2020-08-02 10:06:13 +02:00
Fabien Potencier
1889ba8fba feature #37712 [Mailer] Prevent MessageLoggerListener from leaking in env=prod (vudaltsov)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Mailer] Prevent MessageLoggerListener from leaking in env=prod

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

I was trying to send a batch of emails with `--env=prod` when I noticed that `MessageLoggerListener` was still collecting all the messages and leaking the memory. I tried to do `$this->getApplication()->reset()`, but it didn't work because `MessageLoggerListener` was not tagged (now fixed in #37705).

In this PR I propose to move the declaration of `MessageLoggerListener` to `mailer_debug.php` since the only service depending on it is `mailer.data_collector` from `mailer_debug.php`. If a developer needs to collect sent emails, a custom listener could be implemented on the project side.

- [x] deprecate the service
- [x] add a new one to `mailer_debug.php`
- [ ] add a line to CHANGELOG.md
- [ ] add a line to UPGRADE-5.2.md

Commits
-------

e226775d97 [Mailer] Prevent MessageLoggerListener from leaking in env=prod
2020-08-02 09:59:01 +02:00
vudaltsov
e226775d97 [Mailer] Prevent MessageLoggerListener from leaking in env=prod 2020-08-02 09:58:54 +02:00