Commit Graph

50058 Commits

Author SHA1 Message Date
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
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
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
Robin Chalas
63407d8201 [Console] Allow disabling auto-exit for single command apps 2020-08-03 17:23:43 +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
Fabien Potencier
6c021cb5be minor #37713 [Lock] downgrade log.info to log.debug (rvitaliy)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Lock] downgrade log.info to log.debug

| Q             | A
| ------------- | ---
| Branch?       | master for features / 3.4, 4.4 or 5.1 for bug fixes <!-- see below -->
| Bug fix?      | yes/no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #37710
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

we changed log behavior see issue for more details
<!--
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.
-->

Commits
-------

eea41d9655 [Lock] downgrade log.info to log.debug
2020-08-02 09:57:49 +02:00
Vitaliy Ryaboy
eea41d9655 [Lock] downgrade log.info to log.debug 2020-08-02 09:57:41 +02:00
Laurent Masforné
8e1ffc8b99 Feature #36362 add Isin validator constraint
Feature #36362 typo

Fix PR feedbacks

Fix coding standard

ticket 36362 fix PR feedbacks

Update src/Symfony/Component/Validator/Constraints/IsinValidator.php

Co-Authored-By: Yannis Foucher <33806646+YaFou@users.noreply.github.com>
2020-08-01 14:37:35 +02:00
Simon Heimberg
cea6ebda5b [Security] class Security implements AuthorizationCheckerInterface
The class has the method of AuthorizationCheckerInterface already.
2020-07-31 19:01:17 +02:00
Fabien Potencier
de39dbae8f Fix previous merge 2020-07-31 09:51:09 +02:00
Fabien Potencier
2d5e7b0b25 feature #33729 [Console] Add signal event (marie)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Console] Add signal event

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no
| Tickets       | Fix #33411
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

This new feature allows to set a listener for performing some actions after the console command get a signal.

Usage:

```php
use Symfony\Component\Console\Application;
use Symfony\Component\Console\ConsoleEvents;
use Symfony\Component\Console\Event\ConsoleSignalEvent;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\SignalRegistry\SignalRegistry;
use Symfony\Component\Console\Command\Command;

class HelloWorldCommand extends Command {
    protected static $defaultName = 'app:hello-world';
    protected function execute(InputInterface $input, OutputInterface $output) {}
}

$application = new Application();
$dispatcher = new EventDispatcher();

// Function that will handle signals
$dispatcher->addListener(ConsoleEvents::SIGNAL, function (ConsoleSignalEvent $event) {
    echo 'Handled signal #' . $event->getHandlingSignal() . PHP_EOL;
});

$application->setDispatcher($dispatcher);
$application->setSignalRegistry(new SignalRegistry());

// List of POSIX signals for handling
$application->addHandlingSignals(SIGINT, SIGUSR1);

$application->add(new HelloWorldCommand());
$application->run();
```

Commits
-------

859b692240 [Console] add console.signal event
2020-07-31 09:50:01 +02:00
marie
859b692240 [Console] add console.signal event 2020-07-31 09:49:38 +02:00
Fabien Potencier
b8529a03a6 Fix CHANGELOG 2020-07-31 09:45:25 +02:00
Fabien Potencier
bea6c99db7 feature #36352 [Validator] Added support for cascade validation on typed properties (HeahDude)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Validator] Added support for cascade validation on typed properties

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

This PR leverages PHP 7.4 property types to "guess" typed object members and enable default cascade validation on nested objects.

Before:
```php
use Symfony\Component\Validator\Constraints as Assert;

class Composite
{
    /**
     * @var self[]
     *
     * @Assert\Valid
     */
    public array $children;

    /**
     * @Assert\Valid
     */
    public ?self $parent;

    /**
     * @Assert\Valid
     */
    public static ?self $root;
}
```

After:
```php
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @Assert\Cascade
 */
class Composite
{
    /*
     * @var self[]
     */
    public array $children;
    public ?self $parent;
    public static ?self $root;
}
```

The constraint can also be used in xml, yaml, and of course raw PHP.
___________
Question: is the naming ok, maybe we could use `CascadeValid` to be more explicit?

Commits
-------

f4679ef08a [Validator] Added support for cascade validation on typed properties
2020-07-31 09:44:40 +02:00
Jules Pietri
f4679ef08a [Validator] Added support for cascade validation on typed properties 2020-07-31 09:44:26 +02:00
Fabien Potencier
f1dc422394 feature #37243 [DependencyInjection] Resolve parameters in tag arguments (rpkamp)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[DependencyInjection] Resolve parameters in tag arguments

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Fix #35337
| License       | MIT
| Doc PR        | None, yet, will follow if this is accepted

Arguably this could be a BC break if people are actively relying on parameters not being resolved in tag parameters, although I can't come up with a sensible use case for that scenario.

Commits
-------

3dba1fe7bf [DependencyInjection] Resolve parameters in tag arguments
2020-07-31 09:38:46 +02:00
Remon van de Kamp
3dba1fe7bf [DependencyInjection] Resolve parameters in tag arguments 2020-07-31 09:38:40 +02:00
Fabien Potencier
7aaf99d9f2 feature #37415 [Console] added info method to symfony style (titospeakap, titomiguelcosta)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Console] added info method to symfony style

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

It would be nice to have an info method as part of the SymfonyStyle class. This would prevent having to use the \<INFO\> tag, and it is consistent with other methods like warning and error (similar to the types available in monolog)

Commits
-------

4cf1a1e8e6 fixed docblock
204cd739d3 added info method to symfony style
2020-07-31 09:37:19 +02:00
Fabien Potencier
32941f22d1 feature #36691 [FrameworkBundle] Deprecate some public services to private (fancyweb)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[FrameworkBundle] Deprecate some public services to private

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

Now that we can deprecate public services to private, here is a first pass on the FWB. I think all those services don't need to be public, ie we never need to access them directly in Symfony's code (except in some tests that I had to modify accordingly). I think most of theses services needed to be public before we hooked the AbstractController with a service subscriber. There are definitely more of them that can be deprecated (ie: created workflows and state machines are public but don't need to be ?) but let's start with the easy ones.

Commits
-------

87868baacb [FrameworkBundle] Deprecate some public services to private
2020-07-31 09:12:35 +02:00
Fabien Potencier
5256323bbb feature #36929 Added a FrenchInflector for the String component (Alexandre-T)
This PR was merged into the 5.2-dev branch.

Discussion
----------

Added a FrenchInflector for the String component

I read in [this blog post](https://symfony.com/blog/new-in-symfony-5-1-deprecated-the-inflector-component) this sentence

> Symfony Inflector component converts words between their singular and plural forms (**for now, only in English**)

So I created a FrenchInflector class implementing the InflectorInterface from the String component. This inflector uses regular expressions and it is tested in the FrenchInflectorTest with a lot of the french exceptions.

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

Changelog has been updated, but I'm not sure I did it in the good paragraph.

I don't know if I should update the symfony/symfony-docs, but I have created an example and I could create a PR with it, if you want.

```php
<?php

use Symfony\Component\String\Inflector\FrenchInflector;

$inflector = new FrenchInflector();

$result = $inflector->singularize('dents');     // ['dent']
$result = $inflector->singularize('souris');    // ['souris']
$result = $inflector->singularize('messieurs'); // ['monsieur']

$result = $inflector->pluralize('cinquante'); // ['cinquante']
$result = $inflector->pluralize('pou');       // ['poux']
$result = $inflector->pluralize('cheval');    // ['chevaux']
```

**fabbot.io** is detecting a typo, but this is not. The patch done by fabpot suggests to replace the french 'embarras' word by 'embarrass'. I shall not remove or replace it, because "embarras" is an invariant word.

Commits
-------

d903d9a757 Added a FrenchInflector for the String component French inflector implements InflectorInterface, it uses regexp and it is tested in the FrenchInflectorTest
2020-07-31 09:11:18 +02:00
Fabien Potencier
909158bdb7 bug #37102 [WebProfilerBundle] Fix error with custom function and web profiler routing tab (JakeFr)
This PR was merged into the 4.4 branch.

Discussion
----------

[WebProfilerBundle] Fix error with custom function and web profiler routing tab

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

Here is a simple solution for #36985 as it only concerns WebProfilerBundle.

Due to the limitation in the routing tab as explained in the footnote, the route in my repo did not match in profiler (no query string in the new context) but there is no more syntax error.

Commits
-------

b35c81becb fix error with custom function and web profiler routing tab
2020-07-31 09:05:14 +02:00
Fabien Potencier
281a7522dc minor #37538 Add the name of the env to RuntimeException (Simon Frost)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

Add the name of the env to RuntimeException

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

if you have the name of the env in the exception message it is much easier to find the error

from -> https://github.com/symfony/dependency-injection/pull/20

Commits
-------

00ab757cbb Add the name of the env to RuntimeException
2020-07-31 08:57:38 +02:00
Simon Frost
00ab757cbb Add the name of the env to RuntimeException 2020-07-31 08:57:33 +02:00
Fabien Potencier
4c40ff8392 Fix typo 2020-07-31 08:55:54 +02:00
Fabien Potencier
203ed71ec1 minor #37542 [Mailer] Updated README for the Mailer component (wouterj)
This PR was merged into the 4.4 branch.

Discussion
----------

[Mailer] Updated README for the Mailer component

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | n/a
| License       | MIT
| Doc PR        | symfony/symfony-docs#13945

I think it's worth adding a second example showcasing the twig integration for 2 reasons:

* If you're used to use this component in the framework, I think it's likely you want Twig integration in standalone apps.
* The integration actually lives in `symfony/twig-bridge`, it won't be very easy to catch while reading the component code - unless you're very comfortable with the Symfony architecture.

Commits
-------

696560c690 Updated README for the Mailer component
2020-07-31 08:54:29 +02:00
Fabien Potencier
bea431935f bug #37560 [Finder] Fix GitIgnore parser when dealing with (sub)directories and take order of lines into account (Jeroeny)
This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Finder] Fix GitIgnore parser when dealing with (sub)directories and take order of lines into account

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

The new regex is made per positive `.gitignore` line. Which is a match group followed by a negative lookbehind with all the negations that were on lines after that line. This also fixes some other bugs that didn't match the `.gitignore` spec and two incorrect tests. I think it's likely that there are more edge cases this PR may not cover, but I haven't found them yet.

See the issue for more info.

Commits
-------

609dcf6b08 [Finder] Fix GitIgnore parser when dealing with (sub)directories and take order of lines into account
2020-07-31 08:51:39 +02:00
Jeroeny
609dcf6b08 [Finder] Fix GitIgnore parser when dealing with (sub)directories and take order of lines into account 2020-07-31 08:51:32 +02:00
Fabien Potencier
374d70568c feature #37620 [Security] Use NullToken while checking authorization (wouterj)
This PR was merged into the 5.2-dev branch.

Discussion
----------

[Security] Use NullToken while checking authorization

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

This allows voters to grant access to unauthenticated users. E.g. some objects can be viewed by anyone, in this case the voter has to be able to grant access to unauthenticated users.

This *does break* the interface PHPdoc of `TokenInterface`: `getUser()` returns `null` instead of `string|UserInterface`. This is only true when using the new system, so not a real BC break. I think the only thing we can do to "guide" users is to add some custom handling for type errors related to `null` and `UserInterface` methods ("Did you forgot to check for `null` in the Voter?"). Is this something I should add to this PR?

Commits
-------

e37091541c Use NullToken while checking authorization
2020-07-31 08:44:47 +02:00
Fabien Potencier
bd591057e4 feature #37711 [Router] allow to use \A and \z as regex start and end (zlodes)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

[Router] allow to use \A and \z as regex start and end

| Q             | A
| ------------- | ---
| Branch?       | master <!-- see below -->
| Bug fix?      | yes
| New feature?  | yes <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | —
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

Some people are using `\A` and `\z` as alternative for `^` and `$` for route requirements.

E.g.: UUID pattern in ramsey/uuid (many routes broke after updating the lib):
569e93ac4e (diff-23c8536f7d61e7d839fd1c93ce0dd354L30-R31)

References:
https://www.rexegg.com/regex-anchors.html#A
https://www.rexegg.com/regex-anchors.html#z

P.S.: It is my first PR into Symfony. Maybe I should fix something, just let me know.

Commits
-------

f752eeeaa6 [Router] allow to use \A and \z as regex start and end
2020-07-31 08:30:16 +02:00
Zlatoslav Desyatnikov
f752eeeaa6 [Router] allow to use \A and \z as regex start and end 2020-07-31 08:30:09 +02:00
Fabien Potencier
bfc0351da6 bug #37654 [Messenger] Fix invalid option sslmode in AmazonSqs bridge (jderusse)
This PR was merged into the 5.1 branch.

Discussion
----------

[Messenger] Fix invalid option sslmode in AmazonSqs bridge

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

The sslmode option allows people to use AmazonSqs with non-offical endpoint like the [asyncaws/testing-sqs](https://hub.docker.com/r/asyncaws/testing-sqs) docker image

By fixing precedence of DNS options in https://github.com/symfony/symfony/pull/37269 I introduced a bug that trigger an exception `Unknown option found: [sslmode]`. I apologize for this

This PR adds `sslmode` in list of allowed options

Commits
-------

afbd51b368 Fix invalid option sslmode
2020-07-31 08:25:05 +02:00
Fabien Potencier
13a5e47b97 feature #37703 Update StopwatchPeriod.php (ThomasLandauer)
This PR was squashed before being merged into the 5.2-dev branch.

Discussion
----------

Update StopwatchPeriod.php

Adding `__toString()`, analogous to [`StopwatchEvent`](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Stopwatch/StopwatchEvent.php#L242)

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

Commits
-------

d3c2911f46 Update StopwatchPeriod.php
2020-07-31 08:22:10 +02:00
Thomas Landauer
d3c2911f46 Update StopwatchPeriod.php 2020-07-31 08:22:04 +02:00
Fabien Potencier
79bc5b7001 bug #37687 Fix getTranslationNodeVisitor() return type (dbrekelmans)
This PR was merged into the 5.2-dev branch.

Discussion
----------

Fix getTranslationNodeVisitor() return type

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

When constructing the `TranslationExtension` with any `NodeVisitorInterface` other than `TranslationNodeVisitor`, you will get a type error when calling `getTranslationNodeVisitor()`. This PR fixes that by extracting a new `TranslationNodeVisitorInterface`.

Commits
-------

c1344257f1 Fix getTranslationNodeVisitor() return type
2020-07-31 08:20:27 +02:00