WPIntell

Source evidence

Seeing this error

Remove admin menus by role · support · 2021-04-29T18:31:00+00:00

complaintsentiment
highseverity
1.0relevance
8replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

5 / 31 rows with source links

16.1% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

26 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
Peter Lawrenson unresolved
I just loaded the plugin and I’m seeing this error: Fatal error: Uncaught TypeError: sizeof(): Argument #1 ($var) must be of type Countable|array, null given in /home/plorro/public_html/dev/wp-content/plugins/remove-admin-menus-by-role/views/form.php:56 Stack trace: #0 /home/plorro/public_html/dev/wp-content/plugins/remove-admin-menus-by-role/remove-admin-menus-by-role.php(142): include() #1 /home/plorro/public_html/dev/wp-includes/class-wp-hook.php(292): remove_menu_admin(”) #2 /home/plorro/public_html/dev/wp-includes/class-wp-hook.php(316): WP_Hook->apply_filters(”, Array) #3 /home/plorro/public_html/dev/wp-includes/plugin.php(484): WP_Hook->do_action(Array) #4 /home/plorro/public_html/dev/wp-admin/admin.php(259): do_action(‘toplevel_page_r…’) #5 {main} thrown in /home/plorro/public_html/dev/wp-content/plugins/remove-admin-menus-by-role/views/form.php on line 56 Hi, You get this error when you try to save the settings? Or directly when you arrived on the settings page? Directly when I arrive at the settings page. It shows just after the “Comments 0” checkbox label. I managed to track it down to this line in functions.php of my child theme: `ini_set( ‘display_errors’, 1 );’ The error shows when the line is in-play, but not otherwise. All other stuff in functions.php commented out. All other plugins deactivated. Line 56 in form.php is working out the size of the sub-menu, but the Comments menu item doesn’t have a sub-menu, causing sizeof() to fail. The @ should silence the error but its not doing so with display_errors on. So it looks like its just my setup, not a general issue. It’s strange that the sizeof trigger an error, cause sizeof should return only a warning if the parameter is not of type countable. But i see there is similar bug with this function on PHP8.0. Are you on this version on your environment? Edit: The documentation says it’s normal in PHP8.0 that an error is triggered. See here in change log: https://www.php.net/manual/en/function.count.php So i’ll need to change my code to avoid this in a next version. This reply was modified 5 years ago by manu225 . Yes, 8.0.3. With 7.4 I don’t see the error. With 8 and errors off, there is no error message but the list of menu items is truncated at Comments. With 7.4 I see the full list of menu items. Thanks for the confirmation. I’ll do an update to fix that next week. Hi, I just released the version 1.30, that fix the bug with PHP8. Can you confirm it work on your environment? Yes thank you, works well with PHP8. As with other similar admin-menu plugins, WPBakery Page Builder v5.6, About & Templates menu items are not hidden. I think this is because Bakery doesn’t follow the rules. Its using two keys, vc-general & vc-welcome. It should be using only the one key. I got round it with a custom line. Ok cool, thanks for the feedback 🙂 Can you tell me what is your custom line? So maybe i’ll can fix this bug too.

Comments

8 shown
manu225 2021-05-13T10:42:00+00:00

Hi, You get this error when you try to save the settings? Or directly when you arrived on the settings page?

Peter Lawrenson 2021-05-13T13:00:00+00:00

Directly when I arrive at the settings page. It shows just after the “Comments 0” checkbox label. I managed to track it down to this line in functions.php of my child theme: `ini_set( ‘display_errors’, 1 );’ The error shows when the line is in-play, but not otherwise. All other stuff in functions.php commented out. All other plugins deactivated. Line 56 in form.php is working out the size of the sub-menu, but the Comments menu item doesn’t have a sub-menu, causing sizeof() to fail. The @ should silence the error but its not doing so with display_errors on. So it looks like its just my setup, not a general issue.

manu225 2021-05-13T15:06:00+00:00

It’s strange that the sizeof trigger an error, cause sizeof should return only a warning if the parameter is not of type countable. But i see there is similar bug with this function on PHP8.0. Are you on this version on your environment? Edit: The documentation says it’s normal in PHP8.0 that an error is triggered. See here in change log: https://www.php.net/manual/en/function.count.php So i’ll need to change my code to avoid this in a next version. This reply was modified 5 years ago by manu225 .

Peter Lawrenson 2021-05-13T16:28:00+00:00

Yes, 8.0.3. With 7.4 I don’t see the error. With 8 and errors off, there is no error message but the list of menu items is truncated at Comments. With 7.4 I see the full list of menu items.

manu225 2021-05-14T15:59:00+00:00

Thanks for the confirmation. I’ll do an update to fix that next week.

manu225 2021-05-17T07:29:00+00:00

Hi, I just released the version 1.30, that fix the bug with PHP8. Can you confirm it work on your environment?

Peter Lawrenson 2021-05-17T12:47:00+00:00

Yes thank you, works well with PHP8. As with other similar admin-menu plugins, WPBakery Page Builder v5.6, About & Templates menu items are not hidden. I think this is because Bakery doesn’t follow the rules. Its using two keys, vc-general & vc-welcome. It should be using only the one key. I got round it with a custom line.

manu225 2021-05-17T14:59:00+00:00

Ok cool, thanks for the feedback 🙂 Can you tell me what is your custom line? So maybe i’ll can fix this bug too.