• 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

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author manu225

    (@manu225)

    Hi,

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

    Thread Starter Majeed Raza

    (@lorro)

    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.

    Plugin Author manu225

    (@manu225)

    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 3 years, 6 months ago by manu225.
    Thread Starter Majeed Raza

    (@lorro)

    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.

    Plugin Author manu225

    (@manu225)

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

    Plugin Author manu225

    (@manu225)

    Hi,

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

    Thread Starter Majeed Raza

    (@lorro)

    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.

    Plugin Author manu225

    (@manu225)

    Ok cool, thanks for the feedback ??

    Can you tell me what is your custom line? So maybe i’ll can fix this bug too.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Seeing this error’ is closed to new replies.