Fatal Error in MB_Conditional_Logic after update

Support MB Conditional Logic Fatal Error in MB_Conditional_Logic after updateResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #47765
    YasmineYasmine
    Participant

    Hi Meta Box Team,

    After updating to the latest version, I encountered this fatal error:

    PHP Fatal error: Uncaught TypeError: MB_Conditional_Logic::parse_condition(): Argument #1 ($condition) must be of type array, bool given

    This error did not occur before updating, and rolling back to the previous version fixes it.

    My Implementation of Conditional Logic
    I use the visible key to show/hide fields based on user roles and form conditions.
    Some fields return hidden if they are not needed (i have a complex form and I have implemnented this logic a lot - it worked well):

    $empty = [
        'type'  => 'hidden',
        'class' => 'empty-div-hidden',
    ];

    The visible condition typically looks like this:

    
    'visible' => [
        'when' => [['advisor_status', '=', 'unavailable']],
        'relation' => 'and',
    ],

    In some cases, visible may be empty or evaluate to false, which may be causing the issue.

    Suspected Issue
    It looks like Meta Box now requires an array for all conditions, and false or an empty array may be causing a TypeError.

    Previously, if when conditions were not met, fields would return a hidden field or be ignored, but now it seems Meta Box doesn't handle this the same way.

    Would appreciate any guidance on this—should I change how I handle visible conditions, or is this a bug in the latest update?

    Thanks!
    Yasmine

    #47767
    YasmineYasmine
    Participant

    Ok I found that I needed to make 'hidden' => [true], an array!

    #47775
    PeterPeter
    Moderator

    Thanks for letting us know. Feel free to create a new topic if you have any questions.

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