Uncaught TypeError: RWMB_Clone

Support General Uncaught TypeError: RWMB_Clone

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #44440
    DufflDuffl
    Participant

    Hi, I do not know where to post this, so I post it in general forum:

    This error appears when I activate Metabox. When I deactivate Metabox, the site runs smoothly. Can you help? I have no idea...

    AH01071: Got error 'Fatal error: Uncaught TypeError: RWMB_Clone::html(): Argument #1 ($meta) must be of type array, string given, called in /var/www/vhosts/ostpreussen.net/httpdocs/wp-content/plugins/meta-box/inc/field.php on line 33 and defined in /var/www/vhosts/ostpreussen.net/httpdocs/wp-content/plugins/meta-box/inc/clone.php:6\nStack trace:\n#0 /var/www/vhosts/ostpreussen.net/httpdocs/wp-content/plugins/meta-box/inc/field.php(33): RWMB_Clone::html()\n#1 /var/www/vhosts/ostpreussen.net/httpdocs/wp-content/plugins/meta-box/inc/field.php(535): RWMB_Field::show()\n#2 /var/www/vhosts/ostpreussen.net/httpdocs/wp-content/plugins/meta-box/inc/meta-box.php(212): RWMB_Field::call()\n#3 /var/www/vhosts/ostpreussen.net/httpdocs/wp-admin/includes/template.php(1456): RW_Meta_Box->show()\n#4 /var/www/vhosts/ostpreussen.net/httpdocs/wp-admin/includes/post.php(2369): do_meta_boxes()\n#5 /var/www/vhosts/ostpreussen.net/httpdocs/wp-admin/edit-form-blocks.php(316): the_block_editor_meta_boxes()\n#6 /var/www/vhosts/ostpreussen.net...', referer: https://ostpreussen.net/wp-admin/edit.php?post_type=post&category_name=angerapp-kreis

    #44443
    PeterPeter
    Moderator

    Hello,

    There could be an issue with the field setting clone when registering custom fields on your site. Do you use the code to register custom fields? If yes, please share the code here, I will take a look.

    #44456
    DufflDuffl
    Participant

    Thank you, no, I am not using code here, just the usual user interface.
    Is there anything else I can provide?

    #44460
    PeterPeter
    Moderator

    Hello,

    Please share your site credentials via this contact form https://metabox.io/contact/
    I will take a look.

    #44816
    Cédric DagherirCédric Dagherir
    Participant

    Hi, I have the same issue here. I have an array in my API response like this :

    `"AdditionalLocations": [
    {
    "Address": "GERS FRA",
    "Location": "Gers",
    "LocationId": "FR_DEP_32",
    "AddressDetails": {
    "City": "",
    "Line1": "",
    "Line2": "",
    "State": "GERS",
    "Country": "FRA",
    "PostalCode": ""
    }
    },
    {
    "Address": "LANDES FRA",
    "Location": "Landes",
    "LocationId": "FR_DEP_40",
    "AddressDetails": {
    "City": "",
    "Line1": "",
    "Line2": "",
    "State": "LANDES",
    "Country": "FRA",
    "PostalCode": ""
    }
    },
    {
    "Address": "LOT-ET-GARONNE FRA",
    "Location": "Lot-et-Garonne",
    "LocationId": "FR_DEP_47",
    "AddressDetails": {
    "City": "",
    "Line1": "",
    "Line2": "",
    "State": "LOT-ET-GARONNE",
    "Country": "FRA",
    "PostalCode": ""
    }
    },
    {
    "Address": "PYRÉNÉES-ATLANTIQUES FRA",
    "Location": "Pyrénées-Atlantiques",
    "LocationId": "FR_DEP_64",
    "AddressDetails": {
    "City": "",
    "Line1": "",
    "Line2": "",
    "State": "PYRÉNÉES-ATLANTIQUES",
    "Country": "FRA",
    "PostalCode": ""
    }
    },
    {
    "Address": "HAUTES-PYRÉNÉES FRA",
    "Location": "Hautes-Pyrénées",
    "LocationId": "FR_DEP_65",
    "AddressDetails": {
    "City": "",
    "Line1": "",
    "Line2": "",
    "State": "HAUTES-PYRÉNÉES",
    "Country": "FRA",
    "PostalCode": ""
    }
    }
    ],`

    I need these to be in metas of my CPT. I then created all the metas, and this is what i have for AdditionalLocations :

    array(
                    'id' => 'AdditionalLocations',
                    'name' => 'AdditionalLocations',
                    'type' => 'group',
                    'clone'  => true,
                    'fields' => [
                        [
                            'id'    => 'Address',
                            'name'  => 'Address',
                            'type'  => 'text'
                        ],
                        [
                            'id'    => 'Location',
                            'name'  => 'Location',
                            'type'  => 'text'
                        ],
                        [
                            'id'    => 'LocationId',
                            'name'  => 'LocationId',
                            'type'  => 'text'
                        ],
                        [
                            'id' => 'AddressDetails',
                            'name' => 'AddressDetails',
                            'type' => 'group',
                            'fields' => [
                                [
                                    'id'    => 'City',
                                    'name'  => 'City',
                                    'type'  => 'text'
                                ],
                                [
                                    'id'    => 'Line1',
                                    'name'  => 'Line1',
                                    'type'  => 'text'
                                ],
                                [
                                    'id'    => 'Line2',
                                    'name'  => 'Line2',
                                    'type'  => 'text'
                                ],
                                [
                                    'id'    => 'State',
                                    'name'  => 'State',
                                    'type'  => 'text'
                                ],
                                [
                                    'id'    => 'Country',
                                    'name'  => 'Country',
                                    'type'  => 'text'
                                ],
                                [
                                    'id'    => 'PostalCode',
                                    'name'  => 'PostalCode',
                                    'type'  => 'text'
                                ],
                            ]
                        ]
                    ]
                ),

    If I don't put a group the value I get is "Array". If I don't put 'clone' I don't have any issues but it won't register the values correctly... I need clone to be there as I may have several AdditionalLocations in my API response, but here's the error code I get :

    Warning: foreach() argument must be of type array|object, string given in C:\wamp64\www\website-tai-new\src\web\app\plugins\meta-box-group\group-field.php on line 220
    
    Fatal error: Uncaught TypeError: RWMB_Clone::html(): Argument #1 ($meta) must be of type array, string given, called in C:\wamp64\www\website-tai-new\src\web\app\plugins\meta-box\inc\field.php on line 33 and defined in C:\wamp64\www\website-tai-new\src\web\app\plugins\meta-box\inc\clone.php:6 Stack trace: #0 C:\wamp64\www\website-tai-new\src\web\app\plugins\meta-box\inc\field.php(33): RWMB_Clone::html('Array', Array) #1 C:\wamp64\www\website-tai-new\src\web\app\plugins\meta-box\inc\field.php(535): RWMB_Field::show(Array, true, 8519) #2 C:\wamp64\www\website-tai-new\src\web\app\plugins\meta-box\inc\meta-box.php(212): RWMB_Field::call('show', Array, true, 8519) #3 C:\wamp64\www\website-tai-new\src\web\wp\wp-admin\includes\template.php(1456): RW_Meta_Box->show(Object(WP_Post), Array) #4 C:\wamp64\www\website-tai-new\src\web\wp\wp-admin\edit-form-advanced.php(714): do_meta_boxes(Object(WP_Screen), 'normal', Object(WP_Post)) #5 C:\wamp64\www\website-tai-new\src\web\wp\wp-admin\post.php(206): require('C:\\wamp64\\www\\w...') #6 {main} thrown in C:\wamp64\www\website-tai-new\src\web\app\plugins\meta-box\inc\clone.php on line 6

    I use MetaBox 5.9.2 and MetaBox Group Version 1.3.18 for info.

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