• Hi Rahul!

    I just wanted to report an issue with the Editor role (I haven’t tested lower) and AnsPress.

    On every admin menu item it states:
    Notice: Undefined offset: 2 in /..../wp-admin/includes/plugin.php on line 1573

    Regarding function get_admin_page_parent()

    Since I’m using WordPress 4.4 beta, this is the code which is interacting:

    foreach (array_keys( (array)$submenu ) as $parent) {
    	foreach ( $submenu[$parent] as $submenu_array ) {
    		if ( isset( $_wp_real_parent_file[$parent] ) )
    			$parent = $_wp_real_parent_file[$parent];
    		if ( !empty($typenow) && ($submenu_array[2] == "$pagenow?post_type=$typenow") ) {
    			$parent_file = $parent;
    			return $parent;
    // == Next line: Line 1573 ==
    		} elseif ( $submenu_array[2] == $pagenow && empty($typenow) && ( empty($parent_file) || false === strpos($parent_file, '?') ) ) {
    			$parent_file = $parent;
    			return $parent;
    		} elseif ( isset( $plugin_page ) && ($plugin_page == $submenu_array[2] ) ) {
    			$parent_file = $parent;
    			return $parent;
    		}
    	}
    }

    This means that $submenu_array[2] is undefined and $typenow is empty.

    I’m unsure where to look, but it’s probably backtrace-able (http://php.net/manual/en/function.debug-backtrace.php) and I just wanted to notify this as I’m running WP_DEBUG.

    I think it has something to do with that the menu’s are loaded, but not shown. A capability error as I might say.

    Thanks for all your effort, keep up the good work!

    Marking this topic as not a support question 🙂

    https://ww.wp.xz.cn/plugins/anspress-question-answer/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Rahul Aryan

    (@nerdaryan)

    Hello Sybre,
    Query monitor do not report such error. May be its not related to AnsPress.
    Thanks for reporting, I will check it again.

    Thread Starter Sybre Waaijer

    (@cybr)

    Hi Rahul,

    I actually think this should be reported to the WordPress Core Trac as $submenu_array[2] should be checked for if it has been set or not, before executed in a comparison.
    This will resolve this ‘issue’ for all kinds of situations.

    Maybe it’s situation, of course. I have bunched up many plugins prior to activating yours, AnsPress did however fire the notice. Luckily it’s just that, a notice, so there’s no rush :). Just standards.
    PHP is very forgiving, PHP7 even more so.

    I will report this to Trac when I find the time (and not forget about it) 😀

    Have a wonderful day Rahul! 🙂

    Hello, i have the same bug. It happened after i deactivated a plugin (Query Monitor)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Undefined Offset’ is closed to new replies.