• Hi there,

    After switching to PHP8 you might encounter the following warning:
    PHP Warning: Attempt to read property "ID" on null in .../zip-recipes/class.ziprecipes.php on line 1569

    Here is a quick fix to check whether $post has set prior to access its properties.

    --- class.ziprecipes.org.php    2022-10-11 09:50:30.928611488 +0200
    +++ class.ziprecipes.php        2022-10-11 09:55:14.265627257 +0200
    @@ -1566,7 +1566,7 @@
             $recipe_json_ld = array();
    
             // get recipe id - limitation: only 1 recipe is supported
    -        if (Util::has_shortcode($post->ID, $post)){
    +        if (isset($post) && Util::has_shortcode($post->ID, $post)){
                 // Find recipe
                 $recipe = new Recipe(false, $post->ID);
                 $recipe_json_ld = $recipe->jsonld();

    Cheers!

Viewing 1 replies (of 1 total)
  • Plugin Support jarnovos

    (@jarnovos)

    Hi @theschappy,

    Thank you for notifying us about this, and for providing the quick fix as well!

    This has been relayed to the development team in order to address the behavior in an upcoming release of the plugin.

    Thanks again, feel free let us know if you have any other questions about the plugin.

    Kind regards,
    Jarno

Viewing 1 replies (of 1 total)
  • The topic ‘Attempt to read property “ID” on null in class.ziprecipes.php on line 1569’ is closed to new replies.