Skip to content

Bug in MailgunPayloadConverter.php #51522

@ovgray

Description

@ovgray

Symfony version(s) affected

6.3

Description

MailgunPayloadConverter threw a RejectWebhookException ("Invalid date") when converting a valid Mailgun webhook in which the payload's timestamp value was 1693425964.0000026. json_encode changed that value to 1693425964.0, and the exception occurred because in line 53 the code

\DateTimeImmutable::createFromFormat('U.u', $payload['timestamp']

did not return a DateTimeImmutable.

How to reproduce

run

MailgunPayloadConverter::convert($payload)

with a payload containing a timestamp with a microsecond value less than 000050.

Possible Solution

Replace line 53 with

if (!$date = \DateTimeImmutable::createFromFormat('U.u', number_format($payload['timestamp'], 6, '.', ''))) {

Additional Context

php is version 8,1

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