Bug report: previews fail for unpublished posts

Posted in: Newspaper
Post count: 4

Reproduction:
Click post -> add new
Click preview
Observer failure in errorlog


[02-Feb-2021 01:47:10 UTC] PHP Fatal error: Uncaught Error: Call to a member function format() on bool in /Users/user/Local Sites/wip/app/public/wp-content/plugins/td-cloud-library/state/single/tdb_state_single.php:1666
Stack trace:
#0 /Users/user/Local Sites/wip/app/public/wp-content/plugins/td-cloud-library/wp_templates/tdb_view_single.php(88): tdb_state_single->{closure}()
#1 /Users/user/Local Sites/wip/app/public/wp-content/plugins/td-cloud-library/wp_templates/tdb_view_single.php(88): Closure->__invoke()
#2 /Users/user/Local Sites/wip/app/public/wp-includes/template-loader.php(106): include('/Users/user/Loc...')
#3 /Users/user/Local Sites/wip/app/public/wp-blog-header.php(19): require_once('/Users/user/Loc...')
#4 /Users/user/Local Sites/wip/app/public/index.php(17): require('/Users/user/Loc...')
#5 {main}
thrown in /Users/user/Local Sites/wip/app/public/wp-content/plugins/td-cloud-library/state/single/tdb_state_single.php on line 1666

Cause: get_post_datetime returns a boolean when it fails which is 100% of the time for unpublished previews.

Suggested fix in td-cloud-library/state/single/tdb_state_single.php, line 1666

if ($td_article_date_unix) {
$buffy .= '<meta itemprop="datePublished" content="' . $td_article_date_unix->format( DATE_W3C ) . '">';
}

Post count: 21065

Hello!

We will investigate more this issue and take into account your suggestion.

Thank you for the bug report!

Viewing 2 posts - 1 through 2 (of 2 total)
The forum ‘Newspaper’ is closed to new topics and replies.