[Resuelto] WP_DEBUG – Uncaught Error: [] operator not supported for strings
This support ticket is created hace 6 años, 2 meses. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
I clicked "Delete" next to a custom role (2 users were assigned if that matters) and got this in WP_DEBUG_LOG:
[25-Sep-2018 10:52:06 UTC] PHP Fatal error: Uncaught Error: [] operator not supported for strings in /wp-content/plugins/types-access/includes/Ajax_Helper.php:106
Stack trace:
#0 /wp-includes/class-wp-hook.php(286): Access_Ajax_Helper::wpcf_access_delete_role_form('')
#1 /wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters('', Array)
#2 /wp-includes/plugin.php(453): WP_Hook->do_action(Array)
#3 /wp-admin/admin-ajax.php(100): do_action('wp_ajax_wpcf_ac...')
#4 {main}
thrown in /wp-content/plugins/types-access/includes/Ajax_Helper.php on line 106
I attached a screenshot of what it was and then I changed it to
$users_txt = [ $user->display_name ];
and that worked.
However, notice the 2nd screenshot where 2 were in the custom role and only 1 was displayed in the reassignment prompt. I can confirm that both were successfully reassigned, not just the 1 displayed in the prompt.
I didn't do any testing to confirm, the error is to be expected from the code where we declare $users_txt as an empty string on line 103 and then treat it as an array 3 lines later.
I've escalated this which should be an easy fix, and I'll let you know when it is available.