Skip Navigation

[Resolved] WP_DEBUG – Uncaught Error: [] operator not supported for strings

This support ticket is created 6 years, 2 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 2 replies, has 2 voices.

Last updated by Nigel 6 years, 2 months ago.

Assisted by: Nigel.

Author
Posts
#1114977
Image 2018-09-25 at 6.01.24 AM.png
Image 2018-09-25 at 5.58.00 AM.png

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.

#1115495

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Clifford

Thanks for reporting that.

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.

#1117216

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Clifford

There has been an Access hotfix with a fix for this issue. Please update and let me know if you still have any problems.