• Resolved paulstenning

    (@paulstenning)


    I have Meta Box 5.7.1 installed as a requirement of a WordPress theme.

    error_log has lots of lines like this:

    PHP Warning: Attempt to read property “id” on null in /{path}/wp-content/plugins/meta-box/inc/media-modal.php on line 102

    I don’t know whether this is due to how the theme is using the plugin or a bug in the plugin. However from the WordPress documentation get_current_screen() can return null or WP_Screen and it seems that the plugin code is not allowing for null. As a temporary fix I have changed the code to:

    private function is_attachment_edit_screen(): bool {
    if (get_current_screen()) {
    return get_current_screen()->id === ‘attachment’;
    }
    return false;
    }

    Hopefully this can be fixed in a future release. Thank you.

    • This topic was modified 1 year, 5 months ago by paulstenning. Reason: Added [BUG] to title
    • This topic was modified 1 year, 5 months ago by paulstenning.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[BUG] Attempt to read property “id” on null – media-modal.php on line 102’ is closed to new replies.