-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Description
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