New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faulty core fixes: the case of the disappearing comment #976

Closed
jrfnl opened this Issue Jun 17, 2017 · 0 comments

Comments

@jrfnl
Contributor

jrfnl commented Jun 17, 2017

Summary:

Comment disappears when the above inline control structure gets fixed.

Most likely cause: Generic.ControlStructures.InlineControlStructure

Example:

File: ./src/wp-admin/menu-header.php around line 201

Source:

if ( isset( $submenu_file ) ) {
	if ( $submenu_file == $sub_item[2] )
		$class[] = 'current';
// If plugin_page is set the parent must either match the current page or not physically exist.
// This allows plugin pages with the same hook to exist under different parents.
} elseif (
	( ! isset( $plugin_page ) && $self == $sub_item[2] ) ||
	( isset( $plugin_page ) && $plugin_page == $sub_item[2] && ( $item[2] == $self_type || $item[2] == $self || file_exists($menu_file) === false ) )
) {
	$class[] = 'current';
}

Fixed as:

if ( isset( $submenu_file ) ) {
	if ( $submenu_file == $sub_item[2] ) {
		$class[] = 'current';
	}
} elseif (
	( ! isset( $plugin_page ) && $self == $sub_item[2] ) ||
	( isset( $plugin_page ) && $plugin_page == $sub_item[2] && ( $item[2] == $self_type || $item[2] == $self || file_exists( $menu_file ) === false ) )
) {
	$class[] = 'current';
}

Expected fix:

if ( isset( $submenu_file ) ) {
	if ( $submenu_file == $sub_item[2] ) {
		$class[] = 'current';
	}
// If plugin_page is set the parent must either match the current page or not physically exist.
// This allows plugin pages with the same hook to exist under different parents.
} elseif (
	( ! isset( $plugin_page ) && $self == $sub_item[2] ) ||
	( isset( $plugin_page ) && $plugin_page == $sub_item[2] && ( $item[2] == $self_type || $item[2] == $self || file_exists( $menu_file ) === false ) )
) {
	$class[] = 'current';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment