Skip to content

[RemoteEvent] Fix date parsing remote event payload converter #54712

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

Merged
merged 1 commit into from
Apr 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function convert(array $payload): AbstractMailerEvent
$event = new MailerEngagementEvent($name, $this->getMessageId($payload), $payload);
}

if (!$date = \DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.u\Z', $payload['created_at'])) {
if (!$date = \DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.uP', $payload['created_at'])) {
throw new ParseException(sprintf('Invalid date "%s".', $payload['created_at']));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
'ip' => '127.0.0.1',
'url' => 'https://www.mailersend.com'
]);
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.u\Z', '2024-01-01T12:00:00.000000Z'));
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.uP', '2024-01-01T12:00:00.000000Z'));

return $wh;
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
'ip' => '127.0.0.1',
'url' => 'https://www.mailersend.com'
]);
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.u\Z', '2024-01-01T12:00:00.000000Z'));
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.uP', '2024-01-01T12:00:00.000000Z'));

return $wh;
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
$wh->setTags(["test-tag"]);
$wh->setMetadata([]);
$wh->setReason('');
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.u\Z', '2024-01-01T12:00:00.000000Z'));
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.uP', '2024-01-01T12:00:00.000000Z'));

return $wh;
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
$wh->setTags(["test-tag"]);
$wh->setMetadata([]);
$wh->setReason('Host or domain name not found');
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.u\Z', '2024-01-01T12:00:00.000000Z'));
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.uP', '2024-01-01T12:00:00.000000Z'));

return $wh;
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
$wh->setMetadata([
'ip' => '127.0.0.1'
]);
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.u\Z', '2024-01-01T12:00:00.000000Z'));
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.uP', '2024-01-01T12:00:00.000000Z'));

return $wh;
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
$wh->setMetadata([
'ip' => '127.0.0.1'
]);
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.u\Z', '2024-01-01T12:00:00.000000Z'));
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.uP', '2024-01-01T12:00:00.000000Z'));

return $wh;
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
$wh->setTags(["test-tag"]);
$wh->setMetadata([]);
$wh->setReason('');
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.u\Z', '2024-01-01T12:00:00.000000Z'));
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.uP', '2024-01-01T12:00:00.000000Z'));

return $wh;
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
$wh->setTags(["test-tag"]);
$wh->setMetadata([]);
$wh->setReason('Unknown reason');
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.u\Z', '2024-01-01T12:00:00.000000Z'));
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.uP', '2024-01-01T12:00:00.000000Z'));

return $wh;
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
$wh->setRecipientEmail('test@example.com');
$wh->setTags(["test-tag"]);
$wh->setMetadata([]);
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.u\Z', '2024-01-01T12:00:00.000000Z'));
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.uP', '2024-01-01T12:00:00.000000Z'));

return $wh;
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
'reason' => 'NO_LONGER_WANT',
'readable_reason' => 'I no longer want to receive these emails'
]);
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.u\Z', '2024-01-01T12:00:00.000000Z'));
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.uP', '2024-01-01T12:00:00.000000Z'));

return $wh;
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
],
]);
$wh->setReason('');
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.u\Z', '2024-04-08T09:43:09.500000Z'));
$wh->setDate(\DateTimeImmutable::createFromFormat('Y-m-d\TH:i:s.uP', '2024-04-08T09:43:09.500000Z'));

return $wh;
Loading