• kfsteve

    (@kfsteve)


    In /wp-includes/vars.php, there are a few regex for checking if the current page matches the ‘wp-admin’ folder pattern. For example:-

    preg_match('#/wp-admin/?(.*?)$#i', $_SERVER['PHP_SELF'], $self_matches);

    I would like to point out that depending on the web server $_SERVER['PHP_SELF'] can return forward or backward slashes for the directory separator in Windows. For the backward slashes case, the above pattern will not match \wordpress\wp-admin\admin.php.

    This causes several plugins and themes that I used returns the following error when I try to access the admin settings page:-

    You do not have sufficient permissions to access this page.

    When I change the code to the below, everything works perfectly:-

    preg_match('#/wp-admin/?(.*?)$#i', str_replace('\\', '/', $_SERVER['PHP_SELF']), $self_matches);

    Any temp solution I can use without editing vars.php like above? I am using Google App Engine to run my wordpress locally.

The topic ‘Directory separator in windows’ is closed to new replies.