[Messenger] Added check if json_encode succeeded#35137
[Messenger] Added check if json_encode succeeded#35137fabpot merged 9 commits intosymfony:4.4from toooni:redis_transport_json_error
Conversation
There was a problem hiding this comment.
for 4.4
can you please send another PR for 4.3, where the code is a bit different?
|
@nicolas-grekas 👍#35150 is targeted to 4.3 |
|
Should we do the same for decoding? |
|
@chalasr I am not sure. I don't think there is much to gain when doing the same for decoding. |
…llable in container linting (shieldo) This PR was merged into the 4.4 branch. Discussion ---------- [DependencyInjection] Handle ServiceClosureArgument for callable in container linting | Q | A | ------------- | --- | Branch? | 4.4 (+) | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | (none) | License | MIT Making use of `ServiceClosureArgument` instances in service definitions was not accounted for in container linting when a service type-hints for `callable` in an argument - adding this check ensures that `ServiceClosureArgument` instances are recognised correctly as callables (once they are resolved). Commits ------- e48829e [DependencyInjection] Handle ServiceClosureArgument for callable in container linting
…. services (fancyweb) This PR was merged into the 4.4 branch. Discussion ---------- [FrameworkBundle][ContainerLintCommand] Only skip .errored. services | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - This PR partially reverts #34935 that was a kind of a mistake. Skipping all removed ids cannot work because all private services are in the "removed" ids. So the command ends up not validating much. To still fix the original issue #34858 we need to skip errored services. However, definition errors are not dumped / read (see #34928). So instead, even if it's bad, we can maybe rely on the name for this particular error since it's hardcoded 😕 At least it fixes this case in a simple way 😕 Commits ------- d38cdc9 [FrameworkBundle][ContainerLintCommand] Only skip .errored. services
…buh) This PR was merged into the 4.4 branch. Discussion ---------- [Cache] fix processing chain adapter based cache pool | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #35119 | License | MIT | Doc PR | Commits ------- 8d7fa32 fix processing chain adapter based cache pool
…ure (nicolas-grekas) This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] fix exception in case of PSR17 discovery failure | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - On symfony.com, we need to use HTTPlug for 3rd party libs. When `nyholm/psr7` is not installed, we currently see an exception saying `No HTTPlug clients found.` from `HttpClientDiscovery`. This fixes the message by correctly suggesting `nyholm/psr7` instead, since there *is* an HTTPlug client: `HttplugClient` from our HttpClient component. It's quite unfortunate that `guzzle/psr7` provides no PSR17 factory yet, because that would have solved some part of this deps mess. /cc @Nyholm @sagikazarmark FYI Note that https://packagist.org/providers/psr/http-factory-imp 8000 lementation lists `guzzle/psr7` but this is a wrong solution: no tagged release of it is PSR17-compatible, which means installing it doesn't solve the issue. Commits ------- 96e70a4 [HttpClient] fix exception in case of PSR17 discovery failure
|
Thank you @toooni. |
This PR was submitted for the master branch but it was squashed and merged into the 4.4 branch instead (closes #35137). Discussion ---------- [Messenger] Added check if json_encode succeeded | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | When trying to add a message to redis transport which can not be encoded with `json_encode` there is now a `TransportException` containing the `json_last_error_msg` as the message. I had an issue where I tried to send an email through messenger by symfony mailer which contains a pdf attachment. Instead of an error while sending i got an error `Encoded envelope should have at least a "body"` which happened because the encoded message was `false`. This is not exactly a bugfix, but IMO also not a feature worth being mentioned in the changelog so I am not sure I've filled out the Q/A correctly. Commits ------- a16a574 [Messenger] Added check if json_encode succeeded
This PR was squashed before being merged into the 4.3 branch (closes #35150). Discussion ---------- [Messenger] Added check if json_encode succeeded | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Similar PR as #35137 but for branch 4.3. When trying to add a message to redis transport which can not be encoded with `json_encode` there is now a `TransportException` containing the `json_last_error_msg` as the message. I had an issue where I tried to send an email through messenger by symfony mailer which contains a pdf attachment. Instead of an error while sending i got an error `Encoded envelope should have at least a "body"` which happened because the encoded message was `false`. This is not exactly a bugfix, but IMO also not a feature worth being mentioned in the changelog so I am not sure I've filled out the Q/A correctly. Commits ------- c2bdc4c [Messenger] Added check if json_encode succeeded
This PR was squashed before being merged into the 4.3 branch (closes #35150). Discussion ---------- [Messenger] Added check if json_encode succeeded | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Similar PR as symfony/symfony#35137 but for branch 4.3. When trying to add a message to redis transport which can not be encoded with `json_encode` there is now a `TransportException` containing the `json_last_error_msg` as the message. I had an issue where I tried to send an email through messenger by symfony mailer which contains a pdf attachment. Instead of an error while sending i got an error `Encoded envelope should have at least a "body"` which happened because the encoded message was `false`. This is not exactly a bugfix, but IMO also not a feature worth being mentioned in the changelog so I am not sure I've filled out the Q/A correctly. Commits ------- c2bdc4c4d3 [Messenger] Added check if json_encode succeeded
|
@fabpot @nicolas-grekas Thank you very much. Can I direct you to the issue which led me to this PR? #33920 (comment) Right now the messenger aims to serialize the data in a readable format. This leads to issues with some transports (like redis, doctrine and probably SQS) because of the character encoding when having binary content. This is a problem especially if the mailer is used with an attachment (binary) through messenger. I've fixed the issue by creating a |
This PR was squashed before being merged into the 4.3 branch (closes #35150). Discussion ---------- [Messenger] Added check if json_encode succeeded | Q | A | ------------- | --- | Branch? | 4.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR | Similar PR as symfony/symfony#35137 but for branch 4.3. When trying to add a message to redis transport which can not be encoded with `json_encode` there is now a `TransportException` containing the `json_last_error_msg` as the message. I had an issue where I tried to send an email through messenger by symfony mailer which contains a pdf attachment. Instead of an error while sending i got an error `Encoded envelope should have at least a "body"` which happened because the encoded message was `false`. This is not exactly a bugfix, but IMO also not a feature worth being mentioned in the changelog so I am not sure I've filled out the Q/A correctly. Commits ------- c2bdc4c4d3 [Messenger] Added check if json_encode succeeded
When trying to add a message to redis transport which can not be encoded with
json_encodethere is now aTransportExceptioncontaining thejson_last_error_msgas the message.I had an issue where I tried to send an email through messenger by symfony mailer which contains a pdf attachment. Instead of an error while sending i got an error
Encoded envelope should have at least a "body"which happened because the encoded message wasfalse.This is not exactly a bugfix, but IMO also not a feature worth being mentioned in the changelog so I am not sure I've filled out the Q/A correctly.