Skip to content

[Webhook] SerializerInterface is not actually needed #57567

@jenky

Description

@jenky

Symfony version(s) affected

7.x

Description

You cannot use the "webhook transport" service since the Serializer component is not installed. Try running "composer require symfony/serializer-pack". 

A quick search shows that this line is the only place where the serializer is used in the webhook component.

https://github.com/symfony/webhook/blob/67762b59de4b9e3c6918c44a345f59030923b82d/Server/JsonBodyConfigurator.php#L24

To be fair I don't think this is a bug, however serializer is not really needed to encode the event payload since it's always array, json_encode is fine.

How to reproduce

Create a new SendWebhookMessage then dispatch it without installing the serializer

Possible Solution

Remove SerializerInterface and replace

$body = $this->serializer->serialize($event->getPayload(), 'json');

with

$body = \json_encode($event->getPayload());

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy