• Getting PHP Fatal errors in error log on a client website with Event Post 5.7 in combination with Yoast SEO 19.14 and WordPress 6.1.1

    PHP Warning:  Attempt to read property "ID" on null in ..wp-content/plugins/event-post/eventpost.php on line 1688
    PHP Fatal error:  Uncaught Error: Attempt to assign property "start" on null in ..wp-content/plugins/event-post/eventpost.php:1688
    Stack trace:
    #0 ..wp-content/plugins/event-post/eventpost.php(724): EventPost->retreive()
    #1 ..wp-includes/class-wp-hook.php(310): EventPost->wpseo_schema_webpage(Array)
    #2 ..wp-includes/plugin.php(205): WP_Hook->apply_filters(Array, Array)
    #3 ..wp-content/plugins/wordpress-seo/src/generators/schema-generator.php(150): apply_filters('wpseo_schema_we...', Array, Object(Yoast\WP\SEO\Context\Meta_Tags_Context), Object(Yoast\WP\SEO\Generators\Schema\WebPage), Array)
    #4 ..wp-content/plugins/wordpress-seo/src/generators/schema-generator.php(76): Yoast\WP\SEO\Generators\Schema_Generator->generate_graph(Array, Object(Yoast\WP\SEO\Context\Meta_Tags_Context))
    #5 ..wp-content/plugins/wordpress-seo/src/presentations/indexable-presentation.php(718): Yoast\WP\SEO\Generators\Schema_Generator->generate(Object(Yoast\WP\SEO\Context\Meta_Tags_Context))
    #6 ..wp-content/plugins/wordpress-seo/src/presentations/abstract-presentation.php(66): Yoast\WP\SEO\Presentations\Indexable_Presentation->generate_schema()
    #7 ..wp-content/plugins/wordpress-seo/src/presenters/schema-presenter.php(60): Yoast\WP\SEO\Presentations\Abstract_Presentation->__get('schema')
    #8 ..wp-content/plugins/wordpress-seo/src/presenters/schema-presenter.php(44): Yoast\WP\SEO\Presenters\Schema_Presenter->get()
    #9 ..wp-content/plugins/wordpress-seo/src/integrations/front-end-integration.php(326): Yoast\WP\SEO\Presenters\Schema_Presenter->present()
    #10 ..wp-includes/class-wp-hook.php(308): Yoast\WP\SEO\Integrations\Front_End_Integration->present_head('')
    #11 ..wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters('', Array)
    #12 ..wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #13 ..wp-content/plugins/wordpress-seo/src/integrations/front-end-integration.php(300): do_action('wpseo_head')
    #14 ..wp-includes/class-wp-hook.php(308): Yoast\WP\SEO\Integrations\Front_End_Integration->call_wpseo_head('')
    #15 ..wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
    #16 ..wp-includes/plugin.php(517): WP_Hook->do_action(Array)
    #17 ..wp-includes/general-template.php(3043): do_action('wp_head')
    #18 ..wp-content/themes/hueman/header.php(9): wp_head()
    #19 ..wp-includes/template.php(783): require_once('/is/htdocs/wp10...')
    #20 ..wp-includes/template.php(718): load_template('/is/htdocs/wp10...', true, Array)
    #21 ..wp-includes/general-template.php(48): locate_template(Array, true, true, Array)
    #22 ..wp-content/themes/hueman/archive.php(1): get_header()
    #23 ..wp-includes/template-loader.php(106): include('/is/htdocs/wp10...')
    #24 ..wp-blog-header.php(19): require_once('/is/htdocs/wp10...')
    #25 ..index.php(17): require('/is/htdocs/wp10...')
    #26 {main}
      thrown in ..wp-content/plugins/event-post/eventpost.php on line 1688

    In line 1688 it seems $ob is null under some circumstances:

    $ob->start = get_post_meta($ob->ID, $this->META_START, true);

    Possible fix: Add a check after $ob = get_post($event); line 1682.

    Also, example code in plugin description seems to be invalid or formated in a wrong way.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author enzomangiante

    (@enzomangiante)

    Hello, thanks for your precious feedback with your 2 tickets. We have corrected these problems in our new release.

    Thread Starter Ov3rfly

    (@ov3rfly)

    Changelog 5.7.1 says “Fix crash when there is no event to retreive” which seems to fix above issue.

    But getting PHP Warnings with 5.8.3 now:

    PHP Warning:  Attempt to read property "time_start" on bool in ../wp-content/plugins/event-post/eventpost.php on line 737
    735: function wpseo_schema_webpage($rich_result){
    736:	$event = $this->retreive();
    737:	if ($event->time_start != '' && ...

    Seems an invalid event is retrieved in line 736.

    Observed e.g. on Tag archives which have no posts assigned to the tag.

    Thread Starter Ov3rfly

    (@ov3rfly)

    Also observed on Search result pages /?s=foobar which have no results.

    Plugin Author enzomangiante

    (@enzomangiante)

    Hello, thanks for your feedback, this warning will be fixed in our next release.

    Thread Starter Ov3rfly

    (@ov3rfly)

    Update: When evaluating the current fix we found a new serious problem in category/tags archive and search results when posts are found.

    Call of retreive() via wpseo_schema_webpage() finds an object (the first result) and overwrites fields like $ob->post_excerptwith custom generated value:

    $ob->post_excerpt = $ob->post_excerpt ? $ob->post_excerpt :  trim(strip_tags(excerpt_remove_blocks($ob->post_content)));

    This breaks the usual the_excerpt() return with all its filters in content, also e.g. if <--more--> is used in a post.

    Visible in first post on categories/tags archives and search results.

    Testcase: WordPress 6.1.1, Event Post 5.8.4, Yoast SEO 20.1, Twenty Nineteen, all latest, default settings.

    • Add new post with <--more--> marker as newest post.
    • Open category archive of this post in frontend.
    • Observe that <--more--> marker is not used in newest post, instead custom generated value of Event Post plugin is shown.

    Not sure why this construction with a custom generated value for post_excerpt is used in the first place, this internal WordPress field should actually not be changed at all.

    As a solution maybe if necessary use an own field for custom generated excerpt and/or reconsider the whole logic with $EventPost_cache etc. inretreive() which currently maybe affects too much.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘PHP Fatal error: Attempt to assign property start on null ..’ is closed to new replies.