[wp-trac] [WordPress Trac] #29161: $pagenow variable not set in admin pages on Windows systems
WordPress Trac
noreply at wordpress.org
Sat Aug 9 10:59:07 UTC 2014
#29161: $pagenow variable not set in admin pages on Windows systems
----------------------------+-----------------------------
Reporter: Craxic | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 3.9.1
Severity: normal | Keywords:
Focuses: administration |
----------------------------+-----------------------------
In the most recent version of WordPress:
`vars.php`, starting line 25:
{{{#!php
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);
}}}
The "/" character does not match the "\" character found as the directory
separator on Windows systems. This causes various issues throughout the
entirety of the administration pages, notably that "add_meta_box" ceases
to function correctly.
Would recommend it be changed to something like this:
{{{#!php
$ds = preg_quote(DIRECTORY_SEPARATOR);
if ( is_network_admin() )
preg_match('#'.$ds.'wp-admin'.$ds.'network'.$ds.'?(.*?)$#i',
$_SERVER['PHP_SELF'], $self_matches);
elseif ( is_user_admin() )
preg_match('#'.$ds.'wp-admin'.$ds.'user'.$ds.'?(.*?)$#i',
$_SERVER['PHP_SELF'], $self_matches);
else
preg_match('#'.$ds.'wp-admin'.$ds.'?(.*?)$#i', $_SERVER['PHP_SELF'],
$self_matches);
}}}
Thanks for the wonderful software!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29161>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list