• Resolved signo

    (@signo)


    When DEBUG is turned on i get error Undefined offset: 0 at line 655 of file user-switching.php

    if ( ( 'switch_to_user' === $cap ) and ( $args[0] == $user_id ) ) {
    			$required_caps[] = 'do_not_allow';
    }

    If you add a test for empty at line 655 the error goes away

    if ( ( 'switch_to_user' === $cap ) and ( !empty( $args ) && $args[0] == $user_id ) ) {
    			$required_caps[] = 'do_not_allow';
    }

    https://www.ads-software.com/plugins/user-switching/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    This notice indicates that another plugin on your site is calling current_user_can( 'switch_to_user' ) without passing in a user ID. If I add a test for empty, it just masks the problem rather than identifying the cause.

    Can you disable your other plugins one by one until the error disappears? Let me know which plugin is causing the notice.

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Marking this as resolved because there’s a good chance that the Admin Bar User Switching plugin was causing this notice.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Undefined offset: 0’ is closed to new replies.