• Resolved charlie67p

    (@charlie67p)


    Hi,
    I get a PHP Fatal error when trying to edit Posts in admin. It seems to be related to MFB (I’m not sure).
    I deactivated the plugins one by one, and when MFB is deactivated everything is working fine again.
    I installed the previous versions of MFB : same issue.
    In the last weeks, I did not change any code in my theme / any settings . I just updated plugins …
    Thanks for help

    WordPress 6.8.2
    Secure Custom Fields 6.5.7 

    My LOG :

    [29-Aug-2025 04:46:20 UTC] PHP Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in /home/u000000010/domains/mywebsite.org/public_html/wp-content/plugins/secure-custom-fields/includes/api/api-helpers.php:2542
    Stack trace: 0 /home/u000000010/domains/mywebsite.org/public_html/wp-content/plugins/secure-custom-fields/includes/fields/class-acf-field-select.php(660): acf_maybe_get() 1 /home/u000000010/domains/mywebsite.org/public_html/wp-content/plugins/secure-custom-fields/includes/fields/class-acf-field-select.php(636): acf_field_select->format_value_single() 2 /home/u000000010/domains/mywebsite.org/public_html/wp-includes/class-wp-hook.php(324): acf_field_select->format_value() 3 /home/u000000010/domains/mywebsite.org/public_html/wp-includes/plugin.php(256): WP_Hook->apply_filters() 4 /home/u000000010/domains/mywebsite.org/public_html/wp-content/plugins/secure-custom-fields/includes/acf-hook-functions.php(110): apply_filters_ref_array() 5 /home/u000000010/domains/mywebsite.org/public_html/wp-includes/class-wp-hook.php(324): _acf_apply_hook_variations() 6 /home/u000000010/domains/mywebsite.org/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters() 7 /home/u000000010/domains/mywebsite.org/public_html/wp-content/plugins/secure-custom-fields/includes/acf-value-functions.php(191): apply_filters() 8 /home/u000000010/domains/mywebsite.org/public_html/wp-content/plugins/secure-custom-fields/includes/rest-api/class-acf-rest-api.php(242): acf_format_value() 9 /home/u000000010/domains/mywebsite.org/public_html/wp-includes/rest-api/endpoints/class-wp-rest-controller.php(439): ACF_Rest_Api->load_fields() 10 /home/u000000010/domains/mywebsite.org/public_html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(2098): WP_REST_Controller->add_additional_fields_to_object() 11 /home/u000000010/domains/mywebsite.org/public_html/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php(655): WP_REST_Posts_Controller->prepare_item_for_response() 12 /home/u000000010/domains/mywebsite.org/public_html/wp-includes/rest-api/class-wp-rest-server.php(1292): WP_REST_Posts_Controller->get_item() 13 /home/u000000010/domains/mywebsite.org/public_html/wp-includes/rest-api/class-wp-rest-server.php(1125): WP_REST_Server->respond_to_request() 14 /home/u000000010/domains/mywebsite.org/public_html/wp-includes/rest-api.php(586): WP_REST_Server->dispatch() 15 /home/u000000010/domains/mywebsite.org/public_html/wp-includes/rest-api.php(2973): rest_do_request() 16 [internal function]: rest_preload_api_request() 17 /home/u000000010/domains/mywebsite.org/public_html/wp-includes/block-editor.php(754): array_reduce() 18 /home/u000000010/domains/mywebsite.org/public_html/wp-admin/edit-form-blocks.php(114): block_editor_rest_api_preload() 19 /home/u000000010/domains/mywebsite.org/public_html/wp-admin/post.php(187): require(‘/home/u000000010…’) 20 {main}
    thrown in /home/u000000010/domains/mywebsite.org/public_html/wp-content/plugins/secure-custom-fields/includes/api/api-helpers.php on line 2542

    Thanks

    • This topic was modified 3 months, 2 weeks ago by charlie67p.
Viewing 15 replies - 1 through 15 (of 20 total)
  • Plugin Author Phi Phan

    (@mr2p)

    Hi @charlie67p,

    Thank you for reporting this. Have you tried rollbacking the SCF plugin to the previous version? From the log, it looks like the issue is coming from SCF. MFB displays fields by just calling its API, without adding extra logic.

    Could you share the steps to reproduce this issue? I will test it myself to find the root cause.

    Best, Phi.

    Thread Starter charlie67p

    (@charlie67p)

    Hey, thanks,
    I have no idea how you can reproduce this.

    It happens for the Posts, that I can not Edit, and not even Create new.
    And also for 1 CPT, where I can create New, but not Edit.
    But not for the other CPT’s (using SCF fields as well), no problem at all !
    = complex to understand

    I tried to find if it is a specific ACF field type causing the issue, but I did not find any logic.

    On frontend, the website is working fine. Issue is in Admin.

    I do not have any previous versions of SCF on my computer …

    Without MFB, SCF is working fine. I don’t understand how the one can be affected by the other. I checked again and again my functions.php , I see no reason (and I did not change the code since many weeks)

    I will let some hours for my brain to relax, maybe I’ll find some light later 😀

    Thanks again

    EDIT : Later I will try deactivate all filters in my functions.php, one by one, to be sure it’s not the cause.

    • This reply was modified 3 months, 2 weeks ago by charlie67p.
    • This reply was modified 3 months, 2 weeks ago by charlie67p.
    • This reply was modified 3 months, 2 weeks ago by charlie67p.
    Thread Starter charlie67p

    (@charlie67p)

    important EDIT :
    Finally I found the only old SCF version I have : 6.4.2
    It works ! (with MFB 1.4.3 activated)

    So now I’m a bit confused,
    should I report this issue to the SCF support (knowing that the last version of SCF seems to interact in some ways with MFB…?)

    Plugin Author Phi Phan

    (@mr2p)

    What type of fields do you have on your post? I just ran a quick test on a fresh site with WP 6.8.2, 2024 theme, MFB 1.4.3, and SCF 6.5.7. I created text fields for posts and pages, and MFB displayed them without any issues.

    Thread Starter charlie67p

    (@charlie67p)

    Posts (issue : no Edit and no Create) :
    WYSIWYG, True/False, Link, Text Field, Text, Taxonomy, Select list

    CPT (issue : no Edit ) :
    File, True/False, Text Field, Text, “Objet de la publication”, Repeater with 3 fields ( “Objet de la publication” + Text + Sub-Repeater containing 2 Text fields)

    Plugin Author Phi Phan

    (@mr2p)

    Could you export your field groups and send them to me at [email protected]? If I can reproduce the issue in my local, I’ll have a better change of finding the root cause of the issue.

    Thread Starter charlie67p

    (@charlie67p)

    I sent the Json, Thanks

    Plugin Author Phi Phan

    (@mr2p)

    @charlie67p Thank you for sharing your data. I found the root cause of this issue, you can find the details here https://wordpress.org/support/topic/fatal-error-when-trying-to-edit-post-2/#post-18620193

    I may need to update the code to support some field types for SCF if my proposal isn’t accepted.

    • This reply was modified 3 months, 2 weeks ago by Phi Phan.
    Thread Starter charlie67p

    (@charlie67p)

    Thank you very much for the update @mr2p – and for taking care of it – I will follow this closely !

    Thread Starter charlie67p

    (@charlie67p)

    Hi @mr2p , any news from SCF side ?
    Is there a work around that I can use in order to have both plugins in their last version (without conflict) on my website ?
    I can not update my Posts unless I downgrade SCF (that is not a good idea for the security of the website..)
    – now that my customer asks for many updates, the situation is really problematic –
    Thank you

    Edit :
    You wrote it causes this error for some multiple value field types like SELECT – Can you tell me which types of ACF fields have ”multiple value” ? >> I can try to temporarily deactivate these fields, in order to be able to update my Posts.

    • This reply was modified 3 months, 1 week ago by charlie67p.
    • This reply was modified 3 months, 1 week ago by charlie67p.
    Plugin Author Phi Phan

    (@mr2p)

    Hi @charlie67p,

    I’ve just sent you a link to download the modified version of SCF. It’s safe to install on your site while you wait for an official fix from SCF. If you’d like to follow the issue, here’s my pull request: https://github.com/WordPress/secure-custom-fields/pull/211

    Phi

    Thread Starter charlie67p

    (@charlie67p)

    OK thanks, I will send a feedback if I try the fixed version. I’m a bit scared, though. (big website and a lot of metafields data).
    I’m reading the Pull request. Thank you for that !

    Thread Starter charlie67p

    (@charlie67p)

    For your information :

    When editing a template with the query loop block and some MFB block inside : loading is stuck (never ending spinner icon) – and Console shows many errors like this : Failed to load resource: the server responded with a status of 500() + wp-json/wp/v2/posts?context=edit&offset=0(…)

    When MFB deactivated , editing templates works like normal : the query loop block displays the contents (except MFB content of course)

    Plugin Author Phi Phan

    (@mr2p)

    @charlie67p Which version of SCF are you using? It may be the same conflict error.

    Thread Starter charlie67p

    (@charlie67p)

    Maybe the same yes..

    WordPress 6.8.2
    Meta Field Block 1.4.3
    Secure Custom Fields 6.5.7

Viewing 15 replies - 1 through 15 (of 20 total)

You must be logged in to reply to this topic.