• Resolved Gal Baras

    (@galbaras)


    I have a contact form embedded in pages and a custom post type with this shortcode:

    [dynamichidden page-tittle "CF7_get_post_var key='title'"]

    And I’m seeing this warning in my error_log file:

    PHP Warning: Attempt to read property "post_title" on null in [ROOT]/wp-content/plugins/contact-form-7-dynamic-text-extension/contact-form-7-dynamic-text-extension.php on line 330

    Lines 329 and 330 are:

    global $post;
    $val = $post->$key;

    It seems unreasonable that the $post global is null in any of these situations.

    Any ideas why this happens? It seems to have started when I switched to PHP 8.0.

    Either way, the plugin should not reference an object’s property without first checking the the object isn’t null.

    • This topic was modified 2 years, 11 months ago by Gal Baras.

    The page I need help with: [log in to see the link]

  • The topic ‘Attempt to read property “post_title” on null’ is closed to new replies.