Skip to content

Fatal error: Failed to parse time string #503

Open
@edent

Description

@edent

When submitting this post https://thomasrigby.com/posts/book-review-hokey-pokey-kate-mascarenas/ as a webmention to https://shkspr.mobi/blog/2023/12/book-review-hokey-pokey-kate-mascarenhas/

I get this error:

PHP Fatal error: Uncaught DateMalformedStringException: Failed to parse time string (Wed Jan 01 2025 07:12:49 GMT+0000 (Coordinated Universal Time)) at position 41 (n): Double timezone specification in wp-content/plugins/webmention/includes/Entity/class-item.php:222

public function set_published( $published ) {
if ( is_null( $published ) ) {
return;
}
if ( $published instanceof DateTimeImmutable ) {
$this->published = $published;
} else {
$this->published = new DateTimeImmutable( $published );
}
}

The blog's timestamp is, indeed, Wed Jan 01 2025 07:12:49 GMT+0000 (Coordinated Universal Time) which is invalid. It works if the bracketed portion is removed.

I'll raise this as a bug with the blog, but I wonder if there's any way to make the WebMention appear even if the timestamp can't be parsed? Perhaps defaulting to the time it was submitted?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions