TypeError in fields/post.php when showing revisions

Support MB Revision TypeError in fields/post.php when showing revisions

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #39588
    dotsuniteddotsunited
    Participant

    We have got two custom post types, both with revisions enabled.

    The second custom post type has a meta box with revision set to true and a field of type post which lets us select a single post of the first custom post type.

    After making changes to the actual value of this post field (= selecting a post and saving, so that there are multiple revisions), trying to display the revisions in the WordPress admin panel leads to an error in the main Meta Box plugin code.

    Full error output:

    PHP Fatal error:  Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, string given in [...]/wp-content/plugins/meta-box/inc/fields/post.php:108
    Stack trace:
    #0 [...]/wp-content/plugins/meta-box/inc/field.php(533): RWMB_Post_Field::query()
    #1 [...]/wp-content/plugins/mb-revision/revision.php(175): RWMB_Field::call()
    #2 [...]/wp-content/plugins/mb-revision/revision.php(133): MB_Revision->transform_object_value_to_label()
    #3 [...]/wp-includes/class-wp-hook.php(310): MB_Revision->get_field_value_for_comparison()
    #4 [...]/wp-includes/plugin.php(205): WP_Hook->apply_filters()
    #5 [...]/wp-admin/includes/revision.php(91): apply_filters()
    #6 [...]/wp-admin/includes/ajax-actions.php(3527): wp_get_revision_ui_diff()
    #7 [...]/wp-includes/class-wp-hook.php(308): wp_ajax_get_revision_diffs()
    #8 [...]/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
    #9 [...]/wp-includes/plugin.php(517): WP_Hook->do_action()
    #10 [...]/wp-admin/admin-ajax.php(188): do_action()
    #11 {main}
      thrown in [...]/wp-content/plugins/meta-box/inc/fields/post.php on line 108

    The PHP version is 8.1.

    #39628
    PeterPeter
    Moderator

    Hello,

    Thanks for your feedback.

    I've escalated this issue to the development team to fix it in the next update.

    #40315
    dotsuniteddotsunited
    Participant

    Hi Peter,

    can you give us an update for when the fixed is planed?

    On https://metabox.io/plugins/meta-box-aio/changelog/ and https://metabox.io/plugins/mb-revision/ we see no progres yet.

    thank you

    #40338
    PeterPeter
    Moderator

    Hello,

    This issue is fixed on this commit https://github.com/wpmetabox/meta-box/commit/d0a0f63fd290c16a980ca9948b7aacd7c40f1858
    Please update Meta Box plugin to the latest version 5.6.15 and check this issue on your site again.

    Let me know how it goes.

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