Skip to content

Commit

Permalink
bug #33481 [Messenger] fix empty amqp body returned as false (Tobion)
Browse files Browse the repository at this point in the history
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 php-amqp/php-amqp#351

Commits
-------

ee5cbe3 [Messenger] fix empty amqp body returned as false
  • Loading branch information
nicolas-grekas committed Sep 6, 2019
2 parents 828e5a4 + ee5cbe3 commit d081f16
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -60,9 +60,11 @@ private function getEnvelope(string $queueName): iterable
return;
}

$body = $amqpEnvelope->getBody();

try {
$envelope = $this->serializer->decode([
'body' => $amqpEnvelope->getBody(),
'body' => false === $body ? '' : $body, // workaround https://github.com/pdezwart/php-amqp/issues/351
'headers' => $amqpEnvelope->getHeaders(),
]);
} catch (MessageDecodingFailedException $exception) {
Expand Down

0 comments on commit d081f16

Please sign in to comment.