8000 Form debugger improvements by webmozart · Pull Request #1 · wouterj/symfony · GitHub
[go: up one dir, main page]

Skip to content

Form debugger improvements #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account 8000

Merged
merged 7 commits into from
Dec 30, 2013
Merged

Conversation

webmozart
Copy link

No description provided.

@webmozart
Copy link
8000 Author

btw I changed the icon color from blue to grey to make them less obtrusive. After all, they are not soo important. :)

@wouterj
Copy link
Owner
wouterj commented Dec 30, 2013

@bschussek you should only remove the blue button without + or -. The others are used in many other places aswell (for instance, on the exception pages).

Also, I'm -1 for changing the blue buttons to toggle the sections to these grey buttons. People are used to these blue buttons (they are in the exception pages, in the doctrine profiler and in some other places).
I'm +1 for the grey buttons in the tree.

@webmozart
Copy link
Author

Oh right! Going to fix that.

@wouterj
Copy link
Owner
wouterj commented Dec 30, 2013

And what about moving the new images to the WebProfilerBundle? That would make more sense imo

@@ -29,6 +29,16 @@
/*background: #F6F6F6;*/
margin: -30px -40px -40px;
}
.toggle-button {
display: inline-block;
background: url("/bundles/framework/images/toggler.png") no-repeat top left #ccc;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use {{ asset('bundles/framework/images/toggler.png') }} here and in the other places. Currently this fails when the Symfony installation is not in the root directory.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any real reason why not inline those images like every others?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because the image is a sprite.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you wanna use sprites, you should do it it all way long, not only for 1-2 images.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know why @bschussek choose for sprites, but he used it for all images in the form profiler.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used a sprite here because it reduces the number of DOM elements you need to track in the JavaScript (only one icon instead of two). Do you think that's problematic?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't care which method is just. My method was great, because we could reuse all logic from Sfjs.toggle(), your method is great because it's properbly better optimized (and semantical more correct imo)

@wouterj
Copy link
Owner
wouterj commented Dec 30, 2013

While I agree with you that placing the toggle buttons before the headline is much nicer, it's not consistent with other occurences of that button in symfony. For instance in the exception page:

exception page

color: #800;
}
.errors th, .errors td {
border: 1px solid #800;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be border-color: #800;. This way the border style and width is determined by the main stylesheet

@wouterj
Copy link
Owner
wouterj commented Dec 30, 2013

except from my previous comments: 👍 (really nice done with the error section!) And with the current implementation of the tree, I also know how we can store which things were open in a session :)

@webmozart
Copy link
Author

I moved the buttons behind the headlines again (but now vertically centered), made them blue and re-added the old blue icons which are used in DoctrineBundle (in fact only there).

@wouterj
Copy link
Owner
wouterj commented Dec 30, 2013

Looks awesome! thank you 🎆

wouterj added a commit that referenced this pull request Dec 30, 2013
Form debugger improvements
@wouterj wouterj merged commit c763d65 into wouterj:form_debugger_js Dec 30, 2013
@webmozart
Copy link
Author

Great, thanks! :)

wouterj pushed a commit that referenced this pull request Jan 7, 2014
This PR was submitted for the 2.4 branch but it was merged into the 2.5-dev branch instead (closes symfony#9857).

Discussion
----------

Form Debugger JavaScript improvements

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

Commits
-------

406756d Reverted Sfjs.toggle change
226ac7c Reverted new image
53f164f Fixed asset function
c763d65 Merge pull request #1 from bschussek/issue9857
5afbaeb [WebProfilerBundle] Enlarged the clickable area of the toggle button in the form tree
58559d3 [WebProfilerBundle] Moved toggle icon behind the headlines in the form debugger
a0030b8 [WebProfilerBundle] Changed toggle color back to blue and made headlines in the form debugger clickable
505c5be [WebProfilerBundle] Added "use strict" statements
ebf13ed [WebProfilerBundle] Inverted toggler images and improved button coloring
07994d5 [WebProfilerBundle] Improved JavaScript of the form debugger
11bfda6 [WebProfilerBundle] Vertically centered the icons in the form tree
52b1620 Fixed CS
f21dab2 Added error badge
111a404 Made sections collapsable
60b0764 Improved form tree
0e03189 Expand tree
wouterj pushed a commit that referenced this pull request Oct 5, 2014
…webmozart)

This PR was merged into the 2.3 branch.

Discussion
----------

[Intl] Integrated ICU data into Intl component #1

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#11447, symfony#10807
| License       | MIT
| Doc PR        | -

This PR is an alternative implementation to symfony#11884. It depends on ~~symfony#11906~~ and ~~symfony#11907~~ being merged first (~~these are included in the diff until after a merge+rebase~~ merged+rebased now).

With this PR, the ICU component becomes obsolete. The ICU data is bundled with Intl in two different formats: JSON and the binary ICU resource bundle format (version 2) readable by PHP's `\ResourceBundle` class. For a performance comparison between the two, see my [benchmark](/webmozart/json-res-benchmark).

~~The data is contained in two zip files: json.zip (2.6MB) and rb-v2.zip (3.8MB). The handler~~

```php
\Symfony\Component\Intl\Composer\ScriptHandler::decompressData()
```

~~needs to be added as Composer hook and decompresses the data after install/update.~~

The data is included as text/binary now. Git takes care of the compression.

Before this PR can be merged, I would like to find out what the performance difference between the two formats is in real applications. For that, I need benchmarks from some real-life applications which use ICU data - e.g. in forms (language drop-downs, country selectors etc.) - for both the JSON and the binary data. You can force either format to be used by hard-coding the return value of `Intl::detectDataFormat()` to `Intl::JSON` and `Intl::RB_V2` respectively. I'll also try to create some more realistic benchmarks.

If JSON is not significantly slower/takes up significantly more memory than the binary format, we can drop the binary format altogether.

Commits
-------

be819c1 [Intl] Integrated ICU data into Intl component
wouterj pushed a commit that referenced this pull request Oct 29, 2014
This PR was merged into the 2.6-dev branch.

Discussion
----------

[Debug] expose object_handle

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

This is a small enhancement to the symfony debug C extension that allows fetching an object's handle.
This is the `#number` as displayed by var_dump():
`class stdClass**#1** (0) {}`

This is required for VarDumper to be able to expose objects' handles and thus have more precise dumps.
It will allow inspecting "same" relationships between two *different* dumps.

Commits
-------

5f6b676 [Debug] expose object_handle
wouterj pushed a commit that referenced this pull request Mar 21, 2015
Remove duplicate 'require' for symfony/symfony PR
wouterj pushed a commit that referenced this pull request Mar 21, 2015
…owlan)

This PR was merged into the 2.3 branch.

Discussion
----------

[Yaml] Improve YAML boolean escaping

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#13209
| License       | MIT
| Doc PR        | None

This PR ensures that PHP [values which would be interpreted as booleans][1] in older versions of the YAML spec are escaped with single quotes when dumped by the Dumper.

For example, dumping this:

```php
array(
    'country_code' => 'no',
    'speaks_norwegian' => 'y',
    'heating' => 'on',
)
```

Will produce this YAML:

```yaml
country_code: 'no'
speaks_norwegian: 'y'
heating: 'on'
```

[1]: http://yaml.org/type/bool.html

Commits
-------

8fa056b Inline private 'is quoting required' methods in Escaper
afe827a Merge pull request #2 from larowlan/patch-2
a0ec0fe Add comment as requested
1e0633e Merge pull request #1 from larowlan/patch-1
81a8090 Remove duplicate 'require'
3760e67 [Yaml] Improve YAML boolean escaping
wouterj pushed a commit that referenced this pull request Jun 9, 2015
…alue (ogizanagi)

This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Fix first choice was invalid when using value

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

This PR solves the following issues encountered using question helper and choices questions:
- First choice was not selectable by value.
- ChoiceList with associative choices with mixed string and int keys has same issue with first choice.
- Fix inconsistency by always returning values as strings.

First point exemple:
![screenshot 2015-05-15 a 17 16 12](https://cloud.githubusercontent.com/assets/2211145/7655757/3344b39a-fb26-11e4-9fe7-0775616619bf.PNG)

Last two points are mainly edge cases. Indeed, if a QuestionChoice has something like :
```php
array(
    '0' => 'No environment',
    '1' => 'My environment 1',
    'env_2' => 'My environment 2',
    3 => 'My environment 3',
);
```
as choices, you will not be able to select the first choice and get an `InvalidArgumentException`:

```
There were 2 errors:

1) Symfony\Component\Console\Tests\Helper\QuestionHelperTest::testChoiceFromChoicelistWithMixedKeys with data set #0 ('0', '0')
InvalidArgumentException: Value "0" is invalid

2) Symfony\Component\Console\Tests\Helper\QuestionHelperTest::testChoiceFromChoicelistWithMixedKeys with data set #1 ('No environment', '0')
InvalidArgumentException: Value "No environment" is invalid
```

Moreover, even if you were able to select by value (`No environment`), you'll get an integer instead of a string:
```
Failed asserting that '0' is identical to 0.
```
For more consistency, the solution is to always return a string.

The issue does not exist in 2.6, as the `QuestionChoice::getDefaultValidator` handled things differently.

Commits
-------

03e4ab6 [Console] Fix first choice was invalid when using value
wouterj pushed a commit that referenced this pull request Nov 28, 2015
…eprecation on-demand (nicolas-grekas)

This PR was merged into the 2.8 branch.

Discussion
----------

[Bridge\PhpUnit] Display the stack trace of a deprecation on-demand

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

This PR has been essential into making symfony#16708, and I think everyone working on a 3.0 migration will need this.

Example:

```
$ SYMFONY_DEPRECATIONS_HELPER=/FormExtensionBootstrap3LayoutTest/ ./phpunit src/Symfony/Bridge/Twig/
PHPUnit 4.8.18 by Sebastian Bergmann and contributors.

Testing src/Symfony/Bridge/Twig/
................................................
Remaining deprecation triggered by Symfony\Bridge\Twig\Tests\Extension\FormExtensionBootstrap3LayoutTest::testSingleChoiceGrouped:
The value "false" for the "choices_as_values" option is deprecated since version 2.8 and will not be supported anymore in 3.0. Set this option to "true" and flip the contents of the "choices" option instead.
Stack trace:
#0 src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php(286): trigger_error()
#1 src/Symfony/Component/OptionsResolver/OptionsResolver.php(962): Symfony\Component\Form\Extension\Core\Type\ChoiceType->Symfony\Component\Form\Extension\Core\Type\{closure}()
#2 src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php(277): Symfony\Component\OptionsResolver\OptionsResolver->offsetGet()
#3 src/Symfony/Component/OptionsResolver/OptionsResolver.php(962): Symfony\Component\Form\Extension\Core\Type\ChoiceType->Symfony\Component\Form\Extension\Core\Type\{closure}()
#4 src/Symfony/Component/OptionsResolver/OptionsResolver.php(791): Symfony\Component\OptionsResolver\OptionsResolver->offsetGet()
symfony#5 src/Symfony/Component/Form/ResolvedFormType.php(156): Symfony\Component\OptionsResolver\OptionsResolver->resolve()
symfony#6 src/Symfony/Component/Form/FormFactory.php(119): Symfony\Component\Form\ResolvedFormType->createBuilder()
symfony#7 src/Symfony/Component/Form/FormFactory.php(48): Symfony\Component\Form\FormFactory->createNamedBuilder()
symfony#8 src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php(540): Symfony\Component\Form\FormFactory->createNamed()
symfony#9 [internal function]: Symfony\Component\Form\Tests\AbstractBootstrap3LayoutTest->testSingleChoiceGrouped()
symfony#10 {main}
KO src/Symfony/Bridge/Twig/
```

Commits
-------

5a88fb6 [Bridge\PhpUnit] Display the stack trace of a deprecation on-demand
wouterj pushed a commit that referenced this pull request Aug 10, 2016
wouterj pushed a commit that referenced this pull request Aug 10, 2016
This PR was merged into the 3.2-dev branch.

Discussion
----------

[Serializer] Argument objects

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

Assuming with have the two following entities:

```php
namespace AppBundle\Entity;

class Dummy
{
    public function __construct(int $id, string $name, string $email, AnotherDummy $anotherDummy)
    {
        $this->id = $id;
        $this->name = $name;
        $this->email = $email;
        $this->anotherDummy = $anotherDummy;
    }
}

class AnotherDummy
{
    public function __construct(int $id, string $uuid, bool $isEnabled)
    {
        $this->id = $id;
        $this->uuid = $uuid;
        $this->isEnabled = $isEnabled;
    }
}
```

Doing the following will fail:

```php
$serializer->denormalize(
    [
        'id' => $i,
        'name' => 'dummy',
        'email' => 'du@ex.com',
        'another_dummy' => [
            'id' => 1000 + $i,
            'uuid' => 'azerty',
            'is_enabled' => true,
        ],
    ],
    \AppBundle\Entity\Dummy::class
);
```

with a type error, because the 4th argument passed to `Dummy::__construct()` will be an array. The following patch checks if the type of the argument is an object, and if it is tries to denormalize that object as well.

I'm not sure if it's me missing something or this is a use case that has been omitted (willingly or not), but if it's a valuable patch I would be happy to work on finishing it.

Commits
-------

988eba1 fix tests
98bcb91 Merge pull request #1 from dunglas/theofidry-feature/param-object
7b5d55d Prevent BC in instantiateObject
e437e04 fix reflection type
3fe9802 revert CS
5556fa5 fix
d4cdb00 fix CS
93608dc Add deprecation message
f46a176 Apply patch
f361e52 fix tests
4884a2e f1
e64e999 Address comments
e99a90b Add tests
7bd4ac5 Test
wouterj pushed a commit that referenced this pull request Jun 1, 2021
…h case insensitive (javiereguiluz)

This PR was merged into the 5.3-dev branch.

Discussion
----------

[FrameworkBundle] Make debug:event-dispatcher search case insensitive

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

I was playing with the new features of `debug:event-dispatcher` and I thought that making the new search feature case insensitive could be better:

### Before

```
$ php bin/console debug:event-dispatcher mailer

 [WARNING] The event "mailer" does not have any registered listeners.
```

### After

```
$ php bin/console debug:event-dispatcher mailer

Registered Listeners of Event Dispatcher "debug.event_dispatcher" for "Symfony\Component\Mailer\Event\MessageEvent" Event
=========================================================================================================================

 ------- --------------------------------------------------------------------------- ----------
  Order   Callable                                                                    Priority
 ------- --------------------------------------------------------------------------- ----------
  #1      Symfony\Component\Mailer\EventListener\MessageListener::onMessage()         0
  #2      Symfony\Component\Mailer\EventListener\EnvelopeListener::onMessage()        -255
  #3      Symfony\Component\Mailer\EventListener\MessageLoggerListener::onMessage()   -255
 ------- --------------------------------------------------------------------------- ----------
```

Commits
-------

1e4c7d9 [FrameworkBundle] Make debug:event-dispatcher search case insensitive
wouterj pushed a commit that referenced this pull request Jun 1, 2021
This PR was merged into the 5.2 branch.

Discussion
----------

[VarDumper] Don't pass null to parse_url()

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

This PR fixes a deprecation warning on PHP 8.1:

> parse_url(): Passing null to parameter `#1` ($url) of type string is deprecated

Commits
-------

f1de7a0 [VarDumper] Don't pass null to parse_url()
wouterj pushed a commit that referenced this pull request Jun 20, 2021
This PR was submitted for the 5.4 branch but it was squashed and merged into the 4.4 branch instead.

Discussion
----------

[Process] Fix incorrect parameter type

In the affected line of code, fclose() should ONLY be passed a parameter of type resource, but fopen() can return a value of type bool (if the fopen() fails). This results in a fatal error under PHP 8: Fatal error: Uncaught TypeError: fclose(): Argument #1 ($stream) must be of type resource, bool given.

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

Commits
-------

d1579a2 [Process] Fix incorrect parameter type
wouterj pushed a commit that referenced this pull request Dec 23, 2021
…sport (veewee)

This PR was merged into the 5.3 branch.

Discussion
----------

[Notifier] Use correct factory for the msteams transport

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

Creating a microsoft teams transport through the `Notifier` `Transport::fromDsn()` class results in an exception:

```
PHP Fatal error:  Uncaught TypeError: Symfony\Component\Notifier\Bridge\MicrosoftTeams\MicrosoftTeamsTransport::__construct(): Argument #1 ($path) must be of type string, null given, called in /vendor/symfony/notifier/Transport.php on line 186 and defined in /vendor/symfony/microsoft-teams-notifier/MicrosoftTeamsTransport.php:35
Stack trace:

* snap *
```

This PR uses the correct ms teams transport factory instead.
It is pointed at the `5.3` branch, in which this specific transport was introduced.
The error is also there in all versions upwards. See https://github.com/symfony/symfony/blob/6.1/src/Symfony/Component/Notifier/Transport.php#L84

Commits
-------

87edd23 [Notifier] Use correct factory for the msteams transport
wouterj pushed a commit that referenced this pull request Mar 31, 2022
… AssetsInstallCommand (pavol-tk, GromNaN)

This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] Avoid calling rtrim(null, '/') in AssetsInstallCommand

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

Avoid following deprecation notice:
```
php.INFO: Deprecated: rtrim(): Passing null to parameter #1 ($string) of type string is deprecated
```

Commits
-------

3d92f98 [FrameworkBundle] Avoid calling rtrim(null, '/') in AssetsInstallCommand
wouterj pushed a commit that referenced this pull request Mar 31, 2022
…s (xesxen)

This PR was merged into the 5.4 branch.

Discussion
----------

[RateLimiter] Resolve crash on near-round timestamps

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

Occasionally timestamps will be fully round (eg. 1234567890.000000) or close to it (eg. 1234567890.000031).

When converting those specific float timestamps to string in SlidingWindow (due to `DateTimeImmutable::createFromFormat`), the number is formatted by PHP without any digits. This causes the resulting value of SlidingWindow::getRetryAfter() to be violated with the boolean value `false`.

This patch formats the float to include the decimal digits.

```
Return value of Symfony\Component\RateLimiter\Policy\SlidingWindow::getRetryAfter() must be an instance of DateTimeImmutable, bool returned
#0 .../vendor/symfony/rate-limiter/Policy/SlidingWindowLimiter.php(84): Symfony\Component\RateLimiter\Policy\SlidingWindow->getRetryAfter()
#1 .../usercode.php(123): Symfony\Component\RateLimiter\Policy\SlidingWindowLimiter->consume(1)
```

Commits
-------

4965952 [RateLimiter] Resolve crash on near-round timestamps
wouterj pushed a commit that referenced this pull request Mar 31, 2022
… resource (Seldaek)

This PR was squashed before being merged into the 4.4 branch.

Discussion
----------

[Process] Avoid calling fclose on an already closed resource

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->

I got this in Composer while interrupting an install process with Ctrl-C.

```
PHP Fatal error:  Uncaught TypeError: fclose(): supplied resource is not a valid stream resource in /var/www/composer/vendor/symfony/process/Pipes/AbstractPipes.php:50
Stack trace:
#0 /var/www/composer/vendor/symfony/process/Pipes/AbstractPipes.php(50): fclose()
#1 /var/www/composer/vendor/symfony/process/Pipes/UnixPipes.php(50): Symfony\Component\Process\Pipes\AbstractPipes->close()
#2 [internal function]: Symfony\Component\Process\Pipes\UnixPipes->__destruct()
#3 {main}
  thrown in /var/www/composer/vendor/symfony/process/Pipes/AbstractPipes.php on line 50
```

I am assuming it's due to a process which was not closed properly, which is very likely given we run a bunch of them concurrently.. It's pretty hard to debug as it's also hard to reproduce, so I am not sure what to do except handle this case gracefully in the close/__destruct function and hope that at least lets it clean up processes without crashing this way.

Commits
-------

a9e43a7 [Process] Avoid calling fclose on an already closed resource
wouterj 10000 pushed a commit that referenced this pull request Mar 31, 2022
…alebedev80)

This PR was merged into the 4.4 branch.

Discussion
----------

[Cache] Fix connecting to Redis via a socket file

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

In the [commit](symfony@99b4885) was done follow changes in Traits/RedisTrait.php(188)

Old code:

```$port = $hosts[0]['port'] ?? null;```

New code:

```$port = $hosts[0]['port'] ?? 6379;```

With DSN "redis:///var/run/redis/redis.sock" raise an error:

```
Redis connection "redis:///var/run/redis/redis.sock?dbindex=5" failed: php_network_getaddresses: getaddrinfo failed: Name or service not known
```

Because phpredis doesn't allow socket connections with a port

```
(new Redis)->connect('/var/run/redis/redis.sock', 6379);
```

**Error**

```
PHP Warning:  Redis::connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /root/test_redis.php on line 5
PHP Fatal error:  Uncaught RedisException: php_network_getaddresses: getaddrinfo failed: Name or service not known in /root/test_redis.php:5
Stack trace:
#0 /root/test_redis.php(5): Redis->connect()
#1 {main}
  thrown in /root/test_redis.php on line 5
```

I added additional validation of connection type (by host or socket). Also I fixed condition when RedisSentinel connection call as it supports connections by host only.

Commits
-------

214fdd1 [Cache] Fix connecting to Redis via a socket file
wouterj pushed a commit that referenced this pull request Mar 31, 2022
…se::isNotModified` (HypeMC)

This PR was merged into the 4.4 branch.

Discussion
----------

[HttpFoundation] Fix PHP 8.1 deprecation in `Response::isNotModified`

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

If an `If-None-Match` header is provided in the request and there's no `ETag` header in the response, the following deprecation notice occurs on PHP 8.1 in `Response::isNotModified`:

```
Deprecated: strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated
```

Commits
-------

b909acf [HttpFoundation] Fix PHP 8.1 deprecation in isNotModified
wouterj pushed a commit that referenced this pull request Jul 11, 2022
…ncoding body for c… (Phillip Look)

This PR was merged into the 6.1 branch.

Discussion
----------

[HttpClient][WebProfilerBundle] Catch errors when encoding body for c…

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

In Symfony 6.1 a [button to copy a request as a cURL command](symfony#43931) was introduced for the profiler.

But if I post a binary file containing null characters using the curl-http-client the `HttpClientDataCollector` throws an error.
```
Warning: Uncaught ValueError: escapeshellarg(): Argument #1 ($arg) must not contain any null bytes
```

My solution is to catch the `ValueError` in this situation and to return `null` as the resulting curl command. Returning `null` seems to be the standard handling for unexpectad values in this data collector.

Commits
-------

36e6fa0 [HttpClient][WebProfilerBundle] Catch errors when encoding body for curl command line
wouterj pushed a commit that referenced this pull request Jul 11, 2022
…tpCache (mpdude)

This PR was merged into the 4.4 branch.

Discussion
----------

[HttpKernel] Fix a PHP 8.1 deprecation notice in HttpCache

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

PHP 8.1 may trigger a deprecation notice `PHP Deprecated:  abs(): Passing null to parameter #1 ($num) of type int|float is deprecated in .../symfony/http-kernel/HttpCache/HttpCache.php on line 721`

The reason is that `$entry->getTtl()` may return `null` for cache entries where no freshness information is present.

I think we would err on the safe side by not using stale-while-revalidate behaviour in this case.

Commits
-------

d0955c2 [HttpKernel] Fix a PHP 8.1 deprecation notice in HttpCache
wouterj pushed a commit that referenced this pull request Jul 11, 2022
…in `NativeSessionStorage::save()` (chalasr)

This PR was merged into the 4.4 branch.

Discussion
----------

[HttpFoundation] Fix TypeError on null `$_SESSION`  in `NativeSessionStorage::save()`

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

When sending concurrent requests via ajax async to a route pointing to a controller requiring an authenticated user through a stateful - session-based - firewall that calls `SessionInterface::save()`, it happens that `$_SESSION` is `null` under some conditions which causes the following error on PHP 8.1:

> Exception 'TypeError' with message 'array_keys(): Argument #1 ($array) must be of type array, null given' in /app/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php:246
…app/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php (246)
…age::save called at /app/vendor/symfony/http-foundation/Session/Session.php (198)

The issue prevents me from upgrading to PHP 8.1 in a project I'm working on with `@jwage`.

Commits
-------

05f3e77 [HttpFoundation] Fix TypeError on null `$_SESSION`  in `NativeSessionStorage::save()`
wouterj pushed a commit that referenced this pull request Nov 26, 2022
…ver with null on non-nullable argument (GromNaN)

This PR was merged into the 6.1 branch.

Discussion
----------

[HttpKernel] Fix deprecation for DateTimeValueResolver with null on non-nullable argument

| Q             | A
| ------------- | ---
| Branch?       | 6.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/pull/48098/files#r1013918566
| License       | MIT
| Doc PR        | n/a

Remove deprecation message when the value is `null` and the controller argument is not nullable.

```
Deprecated: DateTimeImmutable::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated
```

This class have been modified in 6.2. The new test case needs to be updated.

Commits
-------

1d7387b Fix deprecation notice when date argument is not nullable and null value is provided
wouterj pushed a commit that referenced this pull request Dec 10, 2022
…iously defined date attribute to the expected class (GromNaN)

This PR was merged into the 6.1 branch.

Discussion
----------

[HttpKernel] In DateTimeValueResolver, convert previously defined date attribute to the expected class

| Q             | A
| ------------- | ---
| Branch?       | 6.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix https://github.com/symfony/symfony/pull/48098/files#r1013997729
| License       | MIT

Convert an instance of `DateTimeInterface` to the expected class if the value was predefined in the request attributes.

```php
# in a request listener
$request->attributes->set('date', new \DateTimeImmutable());
```

```php
class MyController
{
    public function index(\DateTime $date)
    {
        // Use the $date
    }
}
```

```
Uncaught TypeError: MyController::index(): Argument #1 ($date) must be of type DateTime, DateTimeImmutable given
```

Commits
-------

22a1567 Convert previously defined date attribute to the expected class
chalasr pushed a commit that referenced this pull request Dec 18, 2022
…(HypeMC)

This PR was merged into the 6.2 branch.

Discussion
----------

[HttpKernel] Fix `CacheAttributeListener` priority

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

Currently the `CacheAttributeListener` & the `IsGrantedAttributeListener` have the same priority:

```
Registered Listeners for "kernel.controller_arguments" Event
============================================================

 ------- --------------------------------------------------------------------------------------------------------- ----------
  Order   Callable                                                                                                  Priority
 ------- --------------------------------------------------------------------------------------------------------- ----------
  #1      Symfony\Component\HttpKernel\EventListener\CacheAttributeListener::onKernelControllerArguments()          10
  #2      Symfony\Component\Security\Http\EventListener\IsGrantedAttributeListener::onKernelControllerArguments()   10
  #3      Symfony\Component\HttpKernel\EventListener\ErrorListener::onControllerArguments()                         0
 ------- --------------------------------------------------------------------------------------------------------- ----------
```

Since the `CacheAttributeListener` is alphabetically first, it's first to get triggered. This can cause an unauthenticated user to receive a 304 Not modified instead of a 302 Redirect, resulting in the user seeing some stale content from when they were authenticated instead of getting redirected to the login page.

This PR changes the priority of the `CacheAttributeListener` to be lower than that of the `IsGrantedAttributeListener`.

Commits
-------

90eb89f [HttpKernel] Fix CacheAttributeListener priority
wouterj pushed a commit that referenced this pull request Mar 4, 2023
…ixed attributes (delbertooo)

This PR was submitted for the 6.2 branch but it was merged into the 5.4 branch instead.

Discussion
----------

[FrameworkBundle] Fix denyAccessUnlessGranted for mixed attributes

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

Checking authorization against anything that isn't `array|string` will cause PHP errors now. The method `AbstractController::denyAccessUnlessGranted()` sets the given *single* attribute into the exception in case of denied access. The `AuthorizationCheckerInterface` defines that the attribute can be anything, even objects. The parameter type hint `array|string` of `AccessDeniedException::setAttributes()` want's an array of attributes (or a string for convenience).

# Example

```php
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class MyCustomAttribute
{
}

class ProfileController extends AbstractController
{
    public function index(): Response
    {
        $this->denyAccessUnlessGranted(new MyCustomAttribute()); // 💥 ERROR: Symfony\Component\Security\Core\Exception\AccessDeniedException::setAttributes(): Argument #1 ($attributes) must be of type array|string, [...]

        $user = $this->getUser();

        return new Response('Well hi there '.$user->getFirstName());
    }
}
```

# The fix

As the given attribute is a *single* attribute: always wrap it into an array when creating the exception, because the exception expects an array of attributes.

Commits
-------

9ed77f3 [FrameworkBundle] Fix denyAccessUnlessGranted for mixed attributes
wouterj pushed a commit that referenced this pull request Apr 28, 2023
…ring, bool given (danepowell)

This PR was merged into the 5.4 branch.

Discussion
----------

[Console] trim(): Argument #1 () must be of type string, bool given

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  |no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? |no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->
<!--
Replace this notice by a short README for your feature/bugfix.
This will help reviewers and should be a good start for the documentation.

Additionally (see https://symfony.com/releases):
 - Always add tests and ensure they pass.
 - 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 the latest branch.
 - For new features, provide some code snippets to help understand usage.
 - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry
 - Never break backward compatibility (see https://symfony.com/bc).
-->

If you run a Symfony Console application in Git Bash, ANSICON is not set out of the box and results in this (suppressed) error:
> trim(): Argument ($string) must be of type string, bool given

AFAICT, this method is only called from Application::run() and errors are suppressed. So users will never actually see that error. Still, it could have side effects and breaks downstream projects: box-project/box#990

Commits
-------

324b160 trim(): Argument #1 () must be of type string, bool given
wouterj pushed a commit that referenced this pull request Apr 28, 2023
* 5.4:
  trim(): Argument #1 () must be of type string, bool given
  [Dumper] Trim leading newlines when checking if value begins with a space
  Fix the list of supported shells for completions in a phar
wouterj pushed a commit that referenced this pull request Apr 28, 2023
* 6.2:
  Fix test class name
  trim(): Argument #1 () must be of type string, bool given
  Check if trace.curlCommand is defined in profiler
  [Dumper] Trim leading newlines when checking if value begins with a space
  [FrameworkBundle] Make service edges unique
  Fix the list of supported shells for completions in a phar
  Fix the usage of the zsh completion through the fpath discovery
wouterj pushed a commit that referenced this pull request Aug 5, 2023
This PR was squashed before being merged into the 2.8-dev branch (closes #1).

Discussion
----------

Initial support

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

- [x] Composer dependencies
- [x] Interfaces
- [x] Stub
- [x] HttpFoundationFactory implementation
- [x] DiactorosFactory implementation
- [x] StreamedResponse

Commits
-------

ca41146 Initial support
wouterj pushed a commit that referenced this pull request Aug 5, 2023
…he monorepo (fabpot, dunglas, KorvinSzanto, xabbuh, aimeos, ahundiak, Danielss89, rougin, csunolgomez, Jérôme Parmentier, mtibben, Nyholm, ajgarlag, uphlewis, samnela, grachevko, nicolas-grekas, tinyroy, danizord, Daniel Degasperi, rbaarsma, Ekman, 4rthem, derrabus, mleczakm, iluuu1994, Tobion, chalasr, lemon-juice, franmomu, cidosx, erikn69, AurelienPillevesse)

This PR was merged into the 6.4 branch.

Discussion
----------

[PsrHttpMessageBridge] Import the bridge into the monorepo

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

⚠️ Don't squash!

I propose to import the `symfony/psr-http-message-bridge` package into the Symfony monorepo for further maintenance.

Commits
-------

e40dd66 [PsrHttpMessageBridge] Patch return types and fix CS
266c09f [PsrHttpMessageBridge] Import the bridge into the monorepo
0c0323a Add 'src/Symfony/Bridge/PsrHttpMessage/' from commit '581ca6067eb62640de5ff08ee1ba6850a0ee472e'
581ca60 Prepare release 2.3.1
45d0349 Fix CS
6410dda bug symfony#122 Don't rely on Request::getPayload() to populate the parsed body (nicolas-grekas)
ef03b6d Don't rely on Request::getPayload() to populate the parsed body
3c62b81 minor symfony#120 Prepare release 2.3.0 (derrabus)
96acbfd Prepare release 2.3.0
7eedd34 feature symfony#119 Implement ValueResolverInterface (derrabus)
0b54b85 Implement ValueResolverInterface
6b2f5df feature symfony#117 Leverage `Request::getPayload()` to populate the parsed body of PSR-7 requests (AurelienPillevesse)
3a8caad Leverage `Request::getPayload()` to populate the parsed body of PSR-7 requests
18c9e82 minor symfony#118 Add native types where possible (derrabus)
4fd4323 Add native types where possible
28a732c minor symfony#115 Prepare the 2.2.0 release (derrabus)
7944831 cs fix
99ddcaa Prepare the 2.2.0 release
8a5748d feature symfony#113 Bump psr/http-message version (erikn69)
ec83c1c Bump psr/http-message version
694016e feature symfony#114 Drop support for Symfony 4 (derrabus)
b360b35 Drop support for Symfony 4
998d8d2 minor symfony#111 Adjustments for PHP CS Fixer 3 (derrabus)
5fa5f62 Adjustments for PHP CS Fixer 3
a125b93 minor symfony#110 Add PHP 8.2 to CI (derrabus)
4592df2 Add PHP 8.2 to CI
4617ac3 bug symfony#109 perf: ensure timely flush stream buffers (cidosx)
8c8a75b perf: ensure timely flush stream buffers
d444f85 Update changelog
155a7ae bug symfony#107 Ignore invalid HTTP headers when creating PSR7 objects (nicolas-grekas)
9a78a16 Ignore invalid HTTP headers when creating PSR7 objects
bdb2871 minor symfony#104 Add missing .gitattributes (franmomu)
808561a Add missing .gitattributes
316f5cb bug symfony#103 Fix for wrong type passed to moveTo() (lemon-juice)
7f3b5c1 Fix for wrong type passed to moveTo()
22b37c8 minor symfony#101 Release v2.1.2 (chalasr)
c382d76 Release v2.1.2
c81476c feature symfony#100 Allow Symfony 6 (chalasr)
c7a0be3 Allow Symfony 6
df83a38 minor symfony#98 Add PHP 8.1 to CI (derrabus)
b2bd334 Add PHP 8.1 to CI
824711c minor symfony#99 Add return types to fixtures (derrabus)
f8f70fa Add return types to fixtures
d558dcd minor symfony#97 Inline $tmpDir (derrabus)
d152649 Inline $tmpDir
f12a9e6 minor symfony#96 Run PHPUnit on GitHub Actions (derrabus)
ab64c69 Run PHPUnit on GitHub Actions
c901299 bug symfony#95 Allow `psr/log` 2 and 3 (derrabus)
8e13ae4 Allow psr/log 2 and 3
26068fa Minor cleanups
87fabb9 Fix copyright year
3d9241f minor symfony#92 remove link to sensio extra bundle which removed psr7 support (Tobion)
7078739 remove link to sensio extra bundle which removed psr7 support
81db2d4 feature symfony#89 PSR HTTP message converters for controllers (derrabus)
aa26e61 PSR HTTP message converters for controllers
e62b239 minor symfony#91 Fix CS (derrabus)
2bead22 Fix CS
488df9b minor symfony#90 Fix CI failures with Xdebug 3 and test on PHP 7.4/8.0 as well (derrabus)
a6697fd Fix CI failures with Xdebug 3 and test on PHP 7.4/8.0 as well
c62f7d0 Update branch-alias
51a21cb Update changelog
a20fff9 bug symfony#87 Fix populating server params from URI in HttpFoundationFactory (nicolas-grekas)
4933e04 bug symfony#86 Create cookies as raw in HttpFoundationFactory (nicolas-grekas)
66095a5 Fix populating server params from URI in HttpFoundationFactory
42cca49 Create cookies as raw in HttpFoundationFactory
cffb3a8 bug symfony#85 Fix BinaryFileResponse with range to psr response conversion (iluuu1994)
5d5932d Fix BinaryFileResponse with range to psr response conversion
e44f249 bug symfony#81 Don't normalize query string in PsrHttpFactory (nicolas-grekas)
bc25829 Don't normalize query string in PsrHttpFactory
df735ec bug symfony#78 Fix populating default port and headers in HttpFoundationFactory (mleczakm)
4f30401 Fix populating default port and headers in HttpFoundationFactory
1309b64 bug symfony#77 fix conversion for https requests (4rthem)
e86de3f minor symfony#79 Allow installation on php 8 (derrabus)
9243f93 Allow installation on php 8.
d336c73 fix conversion for https requests
126903c Fix format of CHANGELOG.md
ce709cd feature symfony#75 Remove deprecated code (fabpot)
dfc5238 Remove deprecated code
9d3e80d bug symfony#72 Use adapter for UploadedFile objects (nicolas-grekas)
a4f9f6d Use adapter for UploadedFile objects
ec7892b Fix CHANGELOG, bump branch-alias
7ab4fe4 minor symfony#70 Updated CHANGELOG (rbaarsma)
9ad4bcc Updated CHANGELOG
c4c904a minor symfony#71 Cleanup after bump to Symfony v4.4 (nicolas-grekas)
e9a9557 Cleanup after bump to Symfony v4.4
3d10a6c feature symfony#66 Add support for streamed Symfony request (Ekman)
df26630 Add support for streamed Symfony request
5aa8ca9 bug symfony#69 Allow Symfony 5.0 (rbaarsma)
1158149 Allow Symfony 5.0
81ae86d Merge branch '1.1'
a33352a bug symfony#64 Fixed createResponse (ddegasperi)
7a4b449 minor symfony#65 Fix tests (ajgarlag)
19905b0 Fix tests
580de38 Fixed createResponse
9ab9d71 minor symfony#63 Added links to documentation (Nyholm)
59b9406 Added links to documentation
c1cb51c feature symfony#50 Add support for streamed response (danizord)
4133c7a bug symfony#48 Convert Request/Response multiple times (Nyholm)
8564bf7 Convert Request/Response multiple times
7cc1605 Add support for streamed response
aebc14b feature symfony#62 bump to PHP 7.1 (nicolas-grekas)
8e10923 bump to PHP 7.1
5e5e0c3 Revert "Undeprecate DiactorosFactory for 1.1"
921f866 Undeprecate DiactorosFactory for 1.1
8592ca3 bug symfony#61 removed 'Set-Cookie' from header when it is already converted to a Symfony header cookie (tinyroy)
dd1111e removed 'Set-Cookie' from header when it is already converted to a Symfony header cookie
ba672d8 bump branch-alias
5f9a032 typo
f2c48c5 fix tests
3a52e44 bug symfony#59 Fix SameSite attribute conversion from PSR7 to HttpFoundation (ajgarlag)
5ee1f8f Fix SameSite attribute conversion from PSR7 to HttpFoundation
f6d7d3a bug symfony#58 [Bugfix] Typo header set-sookie (grachevko)
16eb6e1 minor symfony#57 Excluded tests from classmap (samnela)
36a8065 Deprecate DiactorosFactory, use nyholm/psr7 for tests
5076934 bug symfony#54 Fix symfony#51 (compatability issue with zendframework/zend-diactoros ^2.0) (uphlewis)
757ea81 [Bugfix] Typo header set-sookie
25f9c3a Excluded tests from classmap
8ff61e5 Fix compatability issue with "zendframework/zend-diactoros": "^2.0." (symfony#51)
53c15a6 updated CHANGELOG
c821241 bumped version to 1.1
f26d01f minor symfony#47 Updated changelog (Nyholm)
c2282e3 Updated changelog
eddd6c8 feature symfony#43 Create PSR-7 messages using PSR-17 factories (ajgarlag)
dd81b4b Create PSR-7 messages using PSR-17 factories
f11f173 feature symfony#45 Fixed broken build (Nyholm)
8780dd3 Fixed broken build
c2b7579 bug symfony#30 Fix the request target in PSR7 Request (mtibben)
94fcfa5 Fix the request target in PSR7 Request
64640ee minor symfony#38 Run PHP 5.3 tests on Precise (Lctrs)
64c0cb0 Run PHP 5.3 tests on Precise
b209840 minor symfony#32 Allow Symfony 4 (dunglas)
97635f1 Allow Symfony 4
147a238 minor symfony#31 test suite compatibility with PHPUnit 6 (xabbuh)
f5c46f0 test suite compatibility with PHPUnit 6
66085f2 preparing 1.0 release
533d3e4 added a CHANGELOG for 1.0
14269f9 bug symfony#28 Fix REQUEST_METHOD on symfony request (csunol)
98ab85a Fix REQUEST_METHOD on symfony request
29be4f8 updated LICENCE year
d2db47c removed obsolete CHANGELOG file
1c30b17 bug symfony#22 Fixes symfony#16 Symfony Request created without any URI (rougin)
a59c572 Fixes symfony#16 Symfony Request created without any URI
7a5aa92 bug symfony#23 Fixes symfony#9 Bridge error when no file is selected (ahundiak, Danielss89)
a1a631a Update assert error message
e5d62e6 Fixes based on code-review
101b608 Handles null file in createrequest bridge.
d16c63c bug symfony#18 Allow multiple calls to Request::getContent() (aimeos)
9624b8b Allow multiple calls to Request::getContent()
9c747c4 Merge pull request symfony#19 from xabbuh/travis-config
a388c43 update Travis CI configuration
ac5cd86 minor symfony#14 Remove use of deprecated 'deep' parameter in tests (KorvinSzanto)
305c0fe Remove use of deprecated 'deep' parameter
3664dc0 minor symfony#7 Test Diactoros Factory with PHP 5.4 (dunglas)
bab1530 Test Diactoros Factory with PHP 5.4
d7660b8 Suggest psr/http-message-implementation
dc7e308 removed the branch alias for now as we are pre 1.0
3f8977e feature #1 Initial support (dunglas)
ca41146 Initial support
01b110b added the initial set of files
wouterj pushed a commit that referenced this pull request Jan 25, 2024
This PR was merged into the 5.4 branch.

Discussion
----------

[Process] Fixed inconsistent test

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | N/A
| License       | MIT

Sometimes the process no longer appears to be running when the signal is sent which causes a LogicException to be thrown. This doesn't appear to be consistent and I can reproduce it randomly on my local machine. To avoid having tests fail at random I decided that it's better to send the signal only if the process is still marked as running.

```bash
amne@wnbpowerbox:~/work/projects/symfony$ php7.4 src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php
The process "'php' '-r' 'echo '\''ready'\''; trigger_error('\''error'\'', E_USER_ERROR);'" exceeded the timeout of 0.5 seconds.
amne@wnbpowerbox:~/work/projects/symfony$ php7.4 src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php
The process "'php' '-r' 'echo '\''ready'\''; trigger_error('\''error'\'', E_USER_ERROR);'" exceeded the timeout of 0.5 seconds.
amne@wnbpowerbox:~/work/projects/symfony$ php7.4 src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php
The process "'php' '-r' 'echo '\''ready'\''; trigger_error('\''error'\'', E_USER_ERROR);'" exceeded the timeout of 0.5 seconds.
amne@wnbpowerbox:~/work/projects/symfony$ php7.4 src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php
The process "'php' '-r' 'echo '\''ready'\''; trigger_error('\''error'\'', E_USER_ERROR);'" exceeded the timeout of 0.5 seconds.
amne@wnbpowerbox:~/work/projects/symfony$ php7.4 src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php
PHP Fatal error:  Uncaught Symfony\Component\Process\Exception\LogicException: Cannot send signal on a non running process. in /home/amne/work/projects/symfony/src/Symfony/Component/Process/Process.php:1502
Stack trace:
#0 /home/amne/work/projects/symfony/src/Symfony/Component/Process/Process.php(516): Symfony\Component\Process\Process->doSignal()
#1 /home/amne/work/projects/symfony/src/Symfony/Component/Process/Tests/ErrorProcessInitiator.php(28): Symfony\Component\Process\Process->signal()
#2 {main}
  thrown in /home/amne/work/projects/symfony/src/Symfony/Component/Process/Process.php on line 1502
```

Commits
-------

00ee4ca [Process] Fixed inconsistent test
wouterj pushed a commit that referenced this pull request Apr 7, 2024
…read from socket (xdanik)

This PR was merged into the 5.4 branch.

Discussion
----------

[Mailer] Throw `TransportException` when unable to read from socket

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? |no
| Issues        | None
| License       | MIT

We are seeing error `fgets(): SSL: Connection reset by peer` multiple times a day from connection to Office 365 SMTP server (smtp.office365.com:587).
It's certainly related to some kind of timeout as we are sending emails from long running queue dispatcher and error shows up only occasionally and never with the first message. We are not seeing this issue with any other SMTP server, but we have not tested much past smtp.mandrillapp.com and local MailHog.

We have tried adjusting the `$pingThreshold` and `$restartThreshold` options, but without much success (well `$restartThreshold = 1` resolves the issue, but it also forces the transport to close connection after each message).

Stack trace:
```
#0 /var/www/vendor/symfony/mailer/Transport/Smtp/Stream/AbstractStream.php(77): fgets(Resource(stream))
#1 /var/www/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(315): Symfony\Component\Mailer\Transport\Smtp\Stream\AbstractStream->readLine()
#2 /var/www/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(181): Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->getFullResponse()
#3 /var/www/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(140): Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->executeCommand("RSET
", Array(1))
#4 /var/www/vendor/symfony/mailer/Mailer.php(45): Symfony\Component\Mailer\Transport\Smtp\SmtpTransport->send(Object(Symfony\Component\Mime\Email), Null)
symfony#5 (our queue dispatcher): Symfony\Component\Mailer\Mailer->send(Object(Symfony\Component\Mime\Email))
```

App is running on PHP 8.0.28 on Debian Linux x64, Mailer v5.4.22.

I would gladly written some tests for this, but I don't know how to simulate calls to low-level stream functions like fgets.

Commits
-------

44d5b57 [Mailer] Throw TransportException when unable to read from socket
wouterj pushed a commit that referenced this pull request Apr 7, 2024
…ling error with no ExpectedTypes (Jeroeny)

This PR was merged into the 6.3 branch.

Discussion
----------

[HttpKernel] Fix `RequestPayloadValueResolver` handling error with no ExpectedTypes

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

The `NotNormalizableValueException` errors in `PartialDenormalizationException->getErrors()` have a `->getExpectedTypes()` method that returns `array|null`.  The `RequestPayloadValueResolver` assumes this is always an array.

When the returned value is `null`, an Exception is thrown with `implode(): Argument #1 ($pieces) must be of type array, string given`.

Also the exception message in case of an empty array was: `This value should be of type .`.

#SymfonyHackday

Commits
-------

0af85fe Fix RequestPayloadValueResolver handling error with no ExpectedTypes
wouterj pushed a commit that referenced this pull request Apr 7, 2024
…hen publishing a message. (jwage)

This PR was squashed before being merged into the 6.4 branch.

Discussion
----------

[Messenger] [Amqp] Handle AMQPConnectionException when publishing a message.

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix symfony#36538 Fix symfony#48241
| License       | MIT

If you have a message handler that dispatches messages to another queue, you can encounter `AMQPConnectionException` with the message "Library error: a SSL error occurred" or "a socket error occurred"  depending on if you are using tls or not or if you are running behind a load balancer or not.

You can manually reproduce this issue by dispatching a message where the handler then dispatches another message to a different queue, then go to rabbitmq admin and close the connection manually, then dispatch another message and when the message handler goes to dispatch the other message, you will get this exception:

```
a socket error occurred
#0 /vagrant/vendor/symfony/amqp-messenger/Transport/AmqpTransport.php(60): Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpSender->send()
#1 /vagrant/vendor/symfony/messenger/Middleware/SendMessageMiddleware.php(62): Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpTransport->send()
#2 /vagrant/vendor/symfony/messenger/Middleware/FailedMessageProcessingMiddleware.php(34): Symfony\Component\Messenger\Middleware\SendMessageMiddleware->handle()
#3 /vagrant/vendor/symfony/messenger/Middleware/DispatchAfterCurrentBusMiddleware.php(61): Symfony\Component\Messenger\Middleware\FailedMessageProcessingMiddleware->handle()
#4 /vagrant/vendor/symfony/messenger/Middleware/RejectRedeliveredMessageMiddleware.php(41): Symfony\Component\Messenger\Middleware\DispatchAfterCurrentBusMiddleware->handle()
symfony#5 /vagrant/vendor/symfony/messenger/Middleware/AddBusNameStampMiddleware.php(37): Symfony\Component\Messenger\Middleware\RejectRedeliveredMessageMiddleware->handle()
symfony#6 /vagrant/vendor/symfony/messenger/Middleware/TraceableMiddleware.php(40): Symfony\Component\Messenger\Middleware\AddBusNameStampMiddleware->handle()
symfony#7 /vagrant/vendor/symfony/messenger/MessageBus.php(70): Symfony\Component\Messenger\Middleware\TraceableMiddleware->handle()
symfony#8 /vagrant/vendor/symfony/messenger/TraceableMessageBus.php(38): Symfony\Component\Messenger\MessageBus->dispatch()
symfony#9 /vagrant/src/Messenger/MessageBus.php(37): Symfony\Component\Messenger\TraceableMessageBus->dispatch()
symfony#10 /vagrant/vendor/symfony/mailer/Mailer.php(66): App\Messenger\MessageBus->dispatch()
symfony#11 /vagrant/src/Mailer/Mailer.php(83): Symfony\Component\Mailer\Mailer->send()
symfony#12 /vagrant/src/Mailer/Mailer.php(96): App\Mailer\Mailer->send()
symfony#13 /vagrant/src/MessageHandler/Trading/StrategySubscriptionMessageHandler.php(118): App\Mailer\Mailer->sendEmail()
symfony#14 /vagrant/src/MessageHandler/Trading/StrategySubscriptionMessageHandler.php(72): App\MessageHandler\Trading\StrategySubscriptionMessageHandler->handle()
symfony#15 /vagrant/vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php(152): App\MessageHandler\Trading\StrategySubscriptionMessageHandler->__invoke()
symfony#16 /vagrant/vendor/symfony/messenger/Middleware/HandleMessageMiddleware.php(91): Symfony\Component\Messenger\Middleware\HandleMessageMiddleware->callHandler()
symfony#17 /vagrant/vendor/symfony/messenger/Middleware/SendMessageMiddleware.php(71): Symfony\Component\Messenger\Middleware\HandleMessageMiddleware->handle()
symfony#18 /vagrant/vendor/symfony/messenger/Middleware/FailedMessageProcessingMiddleware.php(34): Symfony\Component\Messenger\Middleware\SendMessageMiddleware->handle()
symfony#19 /vagrant/vendor/symfony/messenger/Middleware/DispatchAfterCurrentBusMiddleware.php(68): Symfony\Component\Messenger\Middleware\FailedMessageProcessingMiddleware->handle()
symfony#20 /vagrant/vendor/symfony/messenger/Middleware/RejectRedeliveredMessageMiddleware.php(41): Symfony\Component\Messenger\Middleware\DispatchAfterCurrentBusMiddleware->handle()
symfony#21 /vagrant/vendor/symfony/messenger/Middleware/AddBusNameStampMiddleware.php(37): Symfony\Component\Messenger\Middleware\RejectRedeliveredMessageMiddleware->handle()
symfony#22 /vagrant/vendor/symfony/messenger/Middleware/TraceableMiddleware.php(40): Symfony\Component\Messenger\Middleware\AddBusNameStampMiddleware->handle()
symfony#23 /vagrant/vendor/symfony/messenger/MessageBus.php(70): Symfony\Component\Messenger\Middleware\TraceableMiddleware->handle()
symfony#24 /vagrant/vendor/symfony/messenger/TraceableMessageBus.php(38): Symfony\Component\Messenger\MessageBus->dispatch()
symfony#25 /vagrant/vendor/symfony/messenger/RoutableMessageBus.php(54): Symfony\Component\Messenger\TraceableMessageBus->dispatch()
symfony#26 /vagrant/vendor/symfony/messenger/Worker.php(162): Symfony\Component\Messenger\RoutableMessageBus->dispatch()
symfony#27 /vagrant/vendor/symfony/messenger/Worker.php(109): Symfony\Component\Messenger\Worker->handleMessage()
symfony#28 /vagrant/vendor/symfony/messenger/Command/ConsumeMessagesCommand.php(238): Symfony\Component\Messenger\Worker->run()
symfony#29 /vagrant/vendor/symfony/console/Command/Command.php(326): Symfony\Component\Messenger\Command\ConsumeMessagesCommand->execute()
symfony#30 /vagrant/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run()
symfony#31 /vagrant/vendor/symfony/framework-bundle/Console/Application.php(126): Symfony\Component\Console\Application->doRunCommand()
symfony#32 /vagrant/vendor/symfony/console/Application.php(324): Symfony\Bundle\FrameworkBundle\Console\Application->doRunCommand()
symfony#33 /vagrant/vendor/symfony/framework-bundle/Console/Application.php(80): Symfony\Component\Console\Application->doRun()
symfony#34 /vagrant/vendor/symfony/console/Application.php(175): Symfony\Bundle\FrameworkBundle\Console\Application->doRun()
symfony#35 /vagrant/vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php(49): Symfony\Component\Console\Application->run()
symfony#36 /vagrant/vendor/autoload_runtime.php(29): Symfony\Component\Runtime\Runner\Symfony\ConsoleApplicationRunner->run()
symfony#37 /vagrant/bin/console(11): require_once('...')
symfony#38 {main}
```

TODO:

- [x] Add test for retry logic when publishing messages

Commits
-------

f123370 [Messenger] [Amqp] Handle AMQPConnectionException when publishing a message.
wouterj pushed a commit that referenced this pull request Nov 16, 2024
Without the fix running `SYMFONY_PHPUNIT_SKIPPED_TESTS='phpunit.skipped' php
./phpunit src/Symfony/Component/Lock/Tests/Store/DoctrineDbalPostgreSqlStoreTest.php`
without the pdo_pgsql extension enabled the generated skip file looked like this:

```
<?php return array (
  'PHPUnit\\Framework\\DataProviderTestSuite' =>
  array (
    'Symfony\\Component\\Lock\\Tests\\Store\\DoctrineDbalPostgreSqlStoreTest::testInvalidDriver' => 1,
  ),
  'Symfony\\Component\\Lock\\Tests\\Store\\DoctrineDbalPostgreSqlStoreTest' =>
  array (
    'testSaveAfterConflict' => 1,
    'testWaitAndSaveAfterConflictReleasesLockFromInternalStore' => 1,
    'testWaitAndSaveReadAfterConflictReleasesLockFromInternalStore' => 1,
    'testSave' => 1,
    'testSaveWithDifferentResources' => 1,
    'testSaveWithDifferentKeysOnSameResources' => 1,
    'testSaveTwice' => 1,
    'testDeleteIsolated' => 1,
    'testBlockingLocks' => 1,
    'testSharedLockReadFirst' => 1,
    'testSharedLockWriteFirst' => 1,
    'testSharedLockPromote' => 1,
    'testSharedLockPromoteAllowed' => 1,
    'testSharedLockDemote' => 1,
  ),
);
```

Thus, running the tests again with the extension enabled would only run 14
tests instead of the expected total number of 16 tests.

With the patch applied the generated skip file looks like this:

```
<?php return array (
  'Symfony\\Component\\Lock\\Tests\\Store\\DoctrineDbalPostgreSqlStoreTest' =>
  array (
    'testInvalidDriver with data set #0' => 1,
    'testInvalidDriver with data set #1' => 1,
    'testSaveAfterConflict' => 1,
    'testWaitAndSaveAfterConflictReleasesLockFromInternalStore' => 1,
    'testWaitAndSaveReadAfterConflictReleasesLockFromInternalStore' => 1,
    'testSave' => 1,
    'testSaveWithDifferentResources' => 1,
    'testSaveWithDifferentKeysOnSameResources' => 1,
    'testSaveTwice' => 1,
    'testDeleteIsolated' => 1,
    'testBlockingLocks' => 1,
    'testSharedLockReadFirst' => 1,
    'testSharedLockWriteFirst' => 1,
    'testSharedLockPromote' => 1,
    'testSharedLockPromoteAllowed' => 1,
    'testSharedLockDemote' => 1,
  ),
);
```
wouterj pushed a commit that referenced this pull request Nov 16, 2024
… providers (xabbuh)

This PR was merged into the 5.4 branch.

Discussion
----------

[PhpUnitBridge] fix dumping tests to skip with data providers

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

Without the fix running `SYMFONY_PHPUNIT_SKIPPED_TESTS='phpunit.skipped' php ./phpunit src/Symfony/Component/Lock/Tests/Store/DoctrineDbalPostgreSqlStoreTest.php` without the `pdo_pgsql` extension enabled the generated skip file looked like this:

```
<?php return array (
  'PHPUnit\\Framework\\DataProviderTestSuite' =>
  array (
    'Symfony\\Component\\Lock\\Tests\\Store\\DoctrineDbalPostgreSqlStoreTest::testInvalidDriver' => 1,
  ),
  'Symfony\\Component\\Lock\\Tests\\Store\\DoctrineDbalPostgreSqlStoreTest' =>
  array (
    'testSaveAfterConflict' => 1,
    'testWaitAndSaveAfterConflictReleasesLockFromInternalStore' => 1,
    'testWaitAndSaveReadAfterConflictReleasesLockFromInternalStore' => 1,
    'testSave' => 1,
    'testSaveWithDifferentResources' => 1,
    'testSaveWithDifferentKeysOnSameResources' => 1,
    'testSaveTwice' => 1,
    'testDeleteIsolated' => 1,
    'testBlockingLocks' => 1,
    'testSharedLockReadFirst' => 1,
    'testSharedLockWriteFirst' => 1,
    'testSharedLockPromote' => 1,
    'testSharedLockPromoteAllowed' => 1,
    'testSharedLockDemote' => 1,
  ),
);
```

Thus, running the tests again with the extension enabled would only run 14 tests instead of the expected total number of 16 tests.

With the patch applied the generated skip file looks like this:

```
<?php return array (
  'Symfony\\Component\\Lock\\Tests\\Store\\DoctrineDbalPostgreSqlStoreTest' =>
  array (
    'testInvalidDriver with data set #0' => 1,
    'testInvalidDriver with data set #1' => 1,
    'testSaveAfterConflict' => 1,
    'testWaitAndSaveAfterConflictReleasesLockFromInternalStore' => 1,
    'testWaitAndSaveReadAfterConflictReleasesLockFromInternalStore' => 1,
    'testSave' => 1,
    'testSaveWithDifferentResources' => 1,
    'testSaveWithDifferentKeysOnSameResources' => 1,
    'testSaveTwice' => 1,
    'testDeleteIsolated' => 1,
    'testBlockingLocks' => 1,
    'testSharedLockReadFirst' => 1,
    'testSharedLockWriteFirst' => 1,
    'testSharedLockPromote' => 1,
    'testSharedLockPromoteAllowed' => 1,
    'testSharedLockDemote' => 1,
  ),
);
```

Commits
-------

95f41cc fix dumping tests to skip with data providers
wouterj pushed a commit that referenced this pull request Nov 25, 2024
… not throw exception (lyrixx)

This PR was merged into the 5.4 branch.

Discussion
----------

[HttpKernel] Ensure `HttpCache::getTraceKey()` does not throw exception

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

We have such logs in our logs. It's in our raw PHP logs. They are not caught by monolog, it's too early

```
[11-Oct-2024 01:23:33 UTC] PHP Fatal error:  Uncaught Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException: Invalid method override "__CONSTRUCT". in /var/www/redirection.io/backend/blue/vendor/symfony/http-foundation/Request.php:1234
Stack trace:
#0 /var/www/redirection.io/backend/blue/vendor/symfony/http-kernel/HttpCache/HttpCache.php(728): Symfony\Component\HttpFoundation\Request->getMethod()
#1 /var/www/redirection.io/backend/blue/vendor/symfony/http-kernel/HttpCache/HttpCache.php(207): Symfony\Component\HttpKernel\HttpCache\HttpCache->getTraceKey()
#2 /var/www/redirection.io/backend/blue/vendor/symfony/http-kernel/Kernel.php(188): Symfony\Component\HttpKernel\HttpCache\HttpCache->handle()
#3 /var/www/redirection.io/backend/blue/web/app.php(9): Symfony\Component\HttpKernel\Kernel->handle()
#4 {main}
  thrown in /var/www/redirection.io/backend/blue/vendor/symfony/http-foundation/Request.php on line 1234

```

I managed to reproduced locally.
* Before the patch, without the http_cache, symfony returns a 405
* After the patch, without the http_cache, symfony returns a 405
* Before the patch, with the http_cache, symfony returns a 500, without any information (too early)
* After the patch, with the http_cache, symfony returns a 405

Commits
-------

a2ebbe0 [HttpKernel] Ensure HttpCache::getTraceKey() does not throw exception
wouterj pushed a commit that referenced this pull request May 19, 2025
…ctor (MaximePinot)

This PR was merged into the 6.4 branch.

Discussion
----------

[Mime] Fix wrong PHPDoc in `FormDataPart` constructor

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

I believe the PHPDoc is wrong.

As far as I understand, the `FormDataPart` expects instances of `TextPart`:

```php
if (!\is_string($item) && !$item instanceof TextPart) {
    throw new InvalidArgumentException(sprintf('The value of the form field "%s" can only be a string, an array, or an instance of TextPart, "%s" given.', $fieldName, get_debug_type($item)));
}
```
https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/Mime/Part/Multipart/FormDataPart.php#L74

The following code is rejected by PHPStan while it works:

```php
final readonly class Foo
{
    public function bar(): void
    {
        new FormDataPart([
            new TextPart('baz'),
        ]);
    }
}
```

```shell
 ------ -------------------------------------------------------------------------------------------------------------------
  Line   src/Foo.php
 ------ -------------------------------------------------------------------------------------------------------------------
  14     Parameter #1 $fields of class Symfony\Component\Mime\Part\Multipart\FormDataPart constructor expects
         array<array|string|Symfony\Component\Mime\Part\DataPart>, array<int, Symfony\Component\Mime\Part\TextPart> given.
 ------ -------------------------------------------------------------------------------------------------------------------
```

(cc `@B`-Galati)

Commits
-------

886d4ed [Mime] Fix wrong PHPDoc in `FormDataPart` constructor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0