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

Skip to content

[Messenger] PhpSerializer with AmqpExt transport #30455

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
bigfoot90 opened this issue Mar 5, 2019 · 1 comment
Closed

[Messenger] PhpSerializer with AmqpExt transport #30455

bigfoot90 opened this issue Mar 5, 2019 · 1 comment

Comments

@bigfoot90
Copy link

Symfony version(s) affected: dev-master

Description
Trying to use php's native serializer #29958 with amqp transport.
But ending with error

{
    "code": 0,
    "message": "Notice: Undefined index: headers",
    "file": "/srv/vendor/symfony/symfony/src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpSender.php",
    "line": 46
}

How to reproduce
Configuration messenger.yaml:

framework:
    messenger:
        serializer: messenger.transport.native_php_serializer

        transports:
            command: '%env(RABBITMQ_DSN)%/commands'
@yceruto
Copy link
Member

yceruto commented Mar 6, 2019

I can confirm this bug. The encode method of the native PHP serializer doesn't returns the headers index:

return [
'body' => serialize($envelope),
];

and it's required by AmqpSender:

$encodedMessage = $this->serializer->encode($envelope);
try {
$this->connection->publish($encodedMessage['body'], $encodedMessage['headers']);

bugfix sent #30466

Status: Reviewed

@fabpot fabpot closed this as completed Mar 9, 2019
fabpot added a commit that referenced this issue Mar 9, 2019
…es (yceruto)

This PR was merged into the 4.2 branch.

Discussion
----------

[Messenger] Make 'headers' key optional for encoded messages

| Q             | A
| ------------- | ---
| Branch?       | 4.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #30455
| License       | MIT

Commits
-------

bb881c9 Make 'headers' key optional for encoded messages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants