bug #33481 [Messenger] fix empty amqp body returned as false (Tobion)
This PR was merged into the 4.3 branch.
Discussion
----------
[Messenger] fix empty amqp body returned as false
| Q | A
| ------------- | ---
| Branch? | 4.3
| Bug fix? | yes
| New feature? | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets |
| License | MIT
| Doc PR |
Having `false` in the body breaks typehints in the serializer and is not consistent with other transports like doctrine. See https://github.com/pdezwart/php-amqp/issues/351
Commits
-------
ee5cbe3658
[Messenger] fix empty amqp body returned as false
This commit is contained in:
commit
d081f1689b
@ -60,9 +60,11 @@ class AmqpReceiver implements ReceiverInterface, MessageCountAwareInterface
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$body = $amqpEnvelope->getBody();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$envelope = $this->serializer->decode([
|
$envelope = $this->serializer->decode([
|
||||||
'body' => $amqpEnvelope->getBody(),
|
'body' => false === $body ? '' : $body, // workaround https://github.com/pdezwart/php-amqp/issues/351
|
||||||
'headers' => $amqpEnvelope->getHeaders(),
|
'headers' => $amqpEnvelope->getHeaders(),
|
||||||
]);
|
]);
|
||||||
} catch (MessageDecodingFailedException $exception) {
|
} catch (MessageDecodingFailedException $exception) {
|
||||||
|
Reference in New Issue
Block a user