Thanks to visit codestin.com
Credit goes to github.com

Skip to content

wip #3

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

Closed
wants to merge 520 commits into from
Closed

wip #3

wants to merge 520 commits into from

Conversation

mtarld
Copy link
Owner

@mtarld mtarld commented Feb 18, 2022

No description provided.

@mtarld mtarld force-pushed the feat/serializer-profiler branch 5 times, most recently from 9742307 to 8529030 Compare February 18, 2022 10:48
@mtarld mtarld force-pushed the feat/serializer-profiler branch 6 times, most recently from 715a7e0 to 233c54b Compare March 6, 2022 11:21
@mtarld mtarld force-pushed the feat/serializer-profiler branch from 233c54b to a57cce3 Compare March 10, 2022 16:02
markusramsak and others added 18 commits March 11, 2022 17:08
This PR was merged into the 5.4 branch.

Discussion
----------

typehint of DkimOptions algorithm wrong

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

Commits
-------

1468c5b typehint of DkimOptions algorithm wrong
This PR was merged into the 4.4 branch.

Discussion
----------

Remove extra space in NotificationEmail

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

Hi, just a little space character being removed :)

Currently without this "patch" it renders:

> You cannot use "..." if the " CSS Inliner" and "Inky" Twig extensions are not available; try running "composer require twig/cssinliner-extra twig/inky-extra".

Commits
-------

b370b32 Remove extra space in NotificationEmail
…)` (chalasr)

This PR was merged into the 5.4 branch.

Discussion
----------

[Security] Fix return value of `NullToken::getUser()`

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

We went back & forth on this one but according to the history, we've just forgot to do it in symfony#42650.
Note: it's already `null` on 6.0+

Commits
-------

d892a51 Fix return value of `NullToken::getUser()`
…managment (alamirault, fancyweb)

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

Discussion
----------

[symfony/mailjet-mailer] Fix invalid mailjet error managment

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

When mailjet API status code is not 200, response [is structured](https://dev.mailjet.com/email/guides/send-api-v31/) (see-below) and is not currently well managed.

Example of bad request response:

```JSON
{
  "Messages": [
    {
      "Status": "error",
      "Errors": [
        {
          "ErrorIdentifier": "8e28ac9c-1fd7-41ad-825f-1d60bc459189",
          "ErrorCode": "mj-0005",
          "StatusCode": 400,
          "ErrorMessage": "The To is mandatory but missing from the input",
          "ErrorRelatedTo": ["To"]
        }
      ]
    }
  ]
}
```

This PR fix `Undefined index: Message` and add unit tests.

Commits
-------

aa1e12c [symfony/mailjet-mailer] Fix invalid mailjet error managment
…pExecutableFinder (fancyweb)

This PR was merged into the 4.4 branch.

Discussion
----------

[Process] Don't return executable directories in PhpExecutableFinder

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

Directories can be executable and be wrongly returned if some env vars have directory paths as their values.

Commits
-------

947152b [Process] Don't return executable directories in PhpExecutableFinder
…ist (RTUnreal)

This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorHandler] Center icons vertically in trace list

| Q             | A
| ------------- | ---
| Branch?       | 4.4, 5.4, 6.0, 6.1
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | none <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT
| Doc PR        | none <!-- 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.
 - 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).
-->
Make icons centered in trace list and not on the bottom trace-line-header div

Before:
![grafik](https://user-images.githubusercontent.com/22859658/157042250-51bb70c3-0350-4d84-8c80-e5ceb2e72e36.png)
After:
![grafik](https://user-images.githubusercontent.com/22859658/157042208-8023d18a-f39b-45b1-a0ba-7f3522d3be0f.png)

Commits
-------

698cc97 Center icons vertically in trace list
This PR was squashed before being merged into the 5.4 branch.

Discussion
----------

Make FormErrorIterator generic

| Q             | A
| ------------- | ---
| Branch?       | 5.4
| Bug fix?      | yes/no
| New feature?  | yes/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 target 5.4, since it's a follow up of symfony#45322 which introduced some errors in my code.

It allows to typehint the `Form::getErrors` method to return `FormErrorIterator<FormError>` most of the time (which is possible by psalm/phpstan plugins with ReturnTypeProviders).

Commits
-------

08ddac5 Make FormErrorIterator generic
* 4.4:
  Remove extra space in NotificationEmail
  Fix the usage of the Valid constraints in array-based forms
  [DI] fix `ServiceSubscriberTrait` bug where parent has `__call()`
  [HttpClient] Fix reading proxy settings from dotenv when curl is used
  [Process] Don't return executable directories in PhpExecutableFinder
  Center icons vertically in trace list
* 5.4:
  Make FormErrorIterator generic
  [symfony/mailjet-mailer] Fix invalid mailjet error managment
  typehint of DkimOptions algorithm wrong
  Remove extra space in NotificationEmail
  Fix the usage of the Valid constraints in array-based forms
  Fix return value of `NullToken::getUser()`
  [DI] fix `ServiceSubscriberTrait` bug where parent has `__call()`
  [HttpClient] Fix reading proxy settings from dotenv when curl is used
  [Process] Don't return executable directories in PhpExecutableFinder
  Center icons vertically in trace list
* 6.0:
  Make FormErrorIterator generic
  [symfony/mailjet-mailer] Fix invalid mailjet error managment
  typehint of DkimOptions algorithm wrong
  Remove extra space in NotificationEmail
  Fix the usage of the Valid constraints in array-based forms
  Fix return value of `NullToken::getUser()`
  [DI] fix `ServiceSubscriberTrait` bug where parent has `__call()`
  [HttpClient] Fix reading proxy settings from dotenv when curl is used
  [Process] Don't return executable directories in PhpExecutableFinder
  Center icons vertically in trace list
…ansport (everyx)

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

Discussion
----------

[Mailer] fix: stringify from address for ses+api transport

close: symfony#45660

| Q             | A
| ------------- | ---
| Branch?       | 6.0 for bug fixes <!-- see below -->
| 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 symfony#45660 <!-- 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 -->

> There are non-ASCII characters in the email address—The email address string must be 7-bit ASCII. If you want to send to or from email addresses that contain Unicode characters in the domain part of an address, you must encode the domain using Punycode. Punycode is not permitted in the local part of the email address (the part before the @ sign) nor in the "friendly from" name. If you want to use Unicode characters in the "friendly from" name, you must encode the "friendly from" name using MIME encoded-word syntax, as described in [Sending raw email using the Amazon SES API](https://docs.aws.amazon.com/ses/latest/dg/send-email-raw.html). For more information about Punycode, see [RFC 3492](http://tools.ietf.org/html/rfc3492).

\- from [Amazon SES email sending errors](https://docs.aws.amazon.com/ses/latest/dg/troubleshoot-error-messages.html)

We have already stringify to addresses, and we should also stringify the from address.

Commits
-------

69c1bdb fix: stringify from address for ses+api transport
nicolas-grekas and others added 19 commits April 1, 2022 09:54
* 4.4:
  Fix URL to get composer.phar
  Fix appveyor
* 5.4:
  Fix URL to get composer.phar
  Fix appveyor
  [TwigBridge] Fix the build
* 6.0:
  Fix URL to get composer.phar
  Fix appveyor
  [TwigBridge] Fix the build
* 5.4:
  [Bridge/Doctrine] Fix tests
* 6.0:
  [Bridge/Doctrine] Fix tests
* 5.4:
  [Bridge/Doctrine] fix tests
* 6.0:
  [Bridge/Doctrine] fix tests
…on Oracle (rjd22)

This PR was merged into the 4.4 branch.

Discussion
----------

[Messenger] Fix cannot select FOR UPDATE from view on Oracle

| Q             | A
| ------------- | ---
| Branch?       | 4.4 <!-- see below -->
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | Fix symfony#33718
| License       | MIT

I realize this solution is quite getto. I hope to get some feedback on it so we can solve this oracle issue properly but ATM this is a good starting point to reach a proper solution.

For this reason I didn't add tests yet.

What happens is that Oracle doesn't like query's that combine ROWNUM and FOR UPDATE. To solve this the query needs to be wrapped in a subquery that limits the results by ID so:

```sql
SELECT a.* FROM (
    SELECT m.*
    FROM messenger_messages m
    WHERE (m.delivered_at is null OR m.delivered_at < ?) AND (m.available_at <= ?) AND (m.queue_name = ?)
    ORDER BY available_at ASC
) a WHERE ROWNUM <= 1 FOR UPDATE;
```

becomes:

```sql
SELECT * FROM messenger_messages WHERE id in (
    SELECT a.id FROM (
        SELECT m.*
        FROM messenger_messages m
        WHERE (m.delivered_at is null OR m.delivered_at < ?) AND (m.available_at <= ?) AND (m.queue_name = ?)
        ORDER BY available_at ASC
    ) a WHERE ROWNUM <= 1
) FOR UPDATE;
```

I don't really know another way to solve this better. But feel free to nitpick at my solution.

Commits
-------

d4a695f [Messenger] Fix cannot select FOR UPDATE from view on Oracle
* 4.4:
  [Messenger] Fix cannot select FOR UPDATE from view on Oracle
* 5.4:
  [Messenger] Fix cannot select FOR UPDATE from view on Oracle
* 6.0:
  [Messenger] Fix cannot select FOR UPDATE from view on Oracle
…uired arguments (norkunas)

This PR was merged into the 6.1 branch.

Discussion
----------

[Validator] Allow creating constraints with required arguments

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

Before PHP8 validation constraint usage was only possible with providing options as an array, but now with native PHP attributes we can provide as named arguments. And to require some arguments overriding `getRequiredOptions` method in Constraint was necessary to get proper validation. But since PHP8.1 we can just make arguments required in the Attribute constructor and try to unpack them because it is possible now.

Commits
-------

f22433f [Validator] Allow creating constraints with required arguments
@mtarld mtarld force-pushed the feat/serializer-profiler branch from a57cce3 to 0e20ad6 Compare April 1, 2022 12:19
@mtarld mtarld closed this May 17, 2022
@mtarld mtarld deleted the feat/serializer-profiler branch May 17, 2022 12:20
mtarld pushed a commit that referenced this pull request Sep 9, 2022
Prevents:

> Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

on `getDefaultName()` returning `null`
mtarld pushed a commit that referenced this pull request Sep 9, 2022
str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
mtarld pushed a commit that referenced this pull request Sep 9, 2022
…(HypeMC)

This PR was merged into the 5.4 branch.

Discussion
----------

[Console] Fix deprecation when description is null

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

Fixes `str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated` when `getDefaultDescription()` returns `null`, caused by symfony#46574.

Commits
-------

7a08b52 [Console] Fix deprecation when description is null
mtarld added a commit that referenced this pull request Oct 9, 2023
fabpot pushed a commit that referenced this pull request Feb 3, 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)
#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
mtarld pushed a commit that referenced this pull request Mar 17, 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()
#5 /vagrant/vendor/symfony/messenger/Middleware/AddBusNameStampMiddleware.php(37): Symfony\Component\Messenger\Middleware\RejectRedeliveredMessageMiddleware->handle()
#6 /vagrant/vendor/symfony/messenger/Middleware/TraceableMiddleware.php(40): Symfony\Component\Messenger\Middleware\AddBusNameStampMiddleware->handle()
#7 /vagrant/vendor/symfony/messenger/MessageBus.php(70): Symfony\Component\Messenger\Middleware\TraceableMiddleware->handle()
#8 /vagrant/vendor/symfony/messenger/TraceableMessageBus.php(38): Symfony\Component\Messenger\MessageBus->dispatch()
#9 /vagrant/src/Messenger/MessageBus.php(37): Symfony\Component\Messenger\TraceableMessageBus->dispatch()
#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.
mtarld pushed a commit that referenced this pull request Aug 14, 2024
…rsimpsons)

This PR was merged into the 5.4 branch.

Discussion
----------

[Yaml] 🐛 throw ParseException on invalid date

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

(found in symfony-tools/docs-builder#179)

When parsing the following yaml:
```
date: 6418-75-51
```

`symfony/yaml` will throw an exception:
```
$ php main.php
PHP Fatal error:  Uncaught Exception: Failed to parse time string (6418-75-51) at position 6 (5): Unexpected character in /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php:714
Stack trace:
#0 /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php(714): DateTimeImmutable->__construct()
#1 /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php(312): Symfony\Component\Yaml\Inline::evaluateScalar()
#2 /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php(80): Symfony\Component\Yaml\Inline::parseScalar()
#3 /tmp/symfony-yaml/vendor/symfony/yaml/Parser.php(790): Symfony\Component\Yaml\Inline::parse()
#4 /tmp/symfony-yaml/vendor/symfony/yaml/Parser.php(341): Symfony\Component\Yaml\Parser->parseValue()
#5 /tmp/symfony-yaml/vendor/symfony/yaml/Parser.php(86): Symfony\Component\Yaml\Parser->doParse()
#6 /tmp/symfony-yaml/vendor/symfony/yaml/Yaml.php(77): Symfony\Component\Yaml\Parser->parse()
#7 /tmp/symfony-yaml/main.php(8): Symfony\Component\Yaml\Yaml::parse()
#8 {main}
  thrown in /tmp/symfony-yaml/vendor/symfony/yaml/Inline.php on line 714
```

This is because the "month" is invalid. Fixing the "month" will trigger about the same issue because the "day" would be invalid.

With the current change it will throw a `ParseException`.

Commits
-------

6d71a7e 🐛 throw ParseException on invalid date
mtarld pushed a commit that referenced this pull request Dec 3, 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
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.