PHP 7.4 notices

Support General PHP 7.4 noticesResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #36107
    FEDFED
    Participant

    Hi there,

    I recently upgraded my local dev environments to PHP 7.4 and now I'm getting notices on a custom field type that I wasn't getting before. I've been able to prevent the notices from appearing on certain admin screens, by checking the screens and bailing on the execution, but that doesn't seem to be ideal, and it's not working on edit.php screens. This ticket from years ago is somewhat related: https://support.metabox.io/topic/my-custom-metabox-stops-working-on-wp-4-9-8/

    Here are the notices that are appearing on edit.php pages in the admin:

    Notice: Trying to access array offset on value of type null in /wp/wp-content/plugins/meta-box/inc/meta-box.php on line 387
    Notice: Trying to access array offset on value of type null in /wp/wp-content/plugins/meta-box/inc/meta-box.php on line 388

    Here's my code: https://pastebin.com/gM4G1M4F

    Thanks so much!

    #36125
    Long NguyenLong Nguyen
    Moderator

    Hi,

    In your overridden function normalize(), I think you need to return $field for all return statements, don't return void/empty value.
    See here https://github.com/wpmetabox/meta-box/blob/master/inc/fields/checkbox-list.php#L22

    #36127
    FEDFED
    Participant

    That was totally it. Thank you so much for the help!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.