Skip to content

AdminOnly causes a Notice: Undefined offset in wordpress-develop vars. #9

Description

@hellofromtonya

After fixing the AdminOnly test group, we now get the following notice:

Notice: Undefined offset: 1 in /Users/hellofromtonya/Local Sites/wordpress-develop/src/wp-includes/vars.php on line 32

The problem is flagged here https://github.com/WordPress/wordpress-develop/blob/master/src/wp-includes/vars.php#L23-L32

// On which page are we?
if ( is_admin() ) {
	// wp-admin pages are checked more carefully.
	if ( is_network_admin() ) {
		preg_match( '#/wp-admin/network/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
	} elseif ( is_user_admin() ) {
		preg_match( '#/wp-admin/user/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
	} else {
		preg_match( '#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches );
	}
	$pagenow = $self_matches[1];

It may also be linked to another problem we see Rocket when running the AdminOnly test suite:

Test code or tested code did not (only) close its own output buffers

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions