Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#15209 closed defect (bug) (worksforme)

$_SERVER['REQUEST_URI'] Doesn't always work correctly

Reported by: RanY Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:


I had problems with links in the admin panel.
Some of the Query Vars returned twice.

The Normal Link should be:

But it appears as:

And that broke the link. the solution is to use


Instead of


I've changed all the $_SERVERREQUEST_URI? in functions.php and All works!

Source for the solution:

Change History (9)

comment:1 @ryan5 years ago

HTTP_SERVER_VARS is deprecated and won't be set if register_long_arrays is off. Any fix here needs to be done in wp_fix_server_vars(). Can you dump REQUEST_URI before and after wp_fix_server_vars() runs so that we can see if wp_fix_server_vars() is in error?

comment:2 @jacobsantos5 years ago

I would wager a guess and say that the person is still using PHP4, probably PHP4.2.

comment:3 @RanY5 years ago

Actually I'm using PHP5.

echo '<br />' . $_SERVER['REQUEST_URI'];



comment:4 @RanY5 years ago

Ok after some digging i found out that

echo $_SERVER['SERVER_SOFTWARE'];  // Results: Microsoft-IIS/6.5beta

The weired thing that i'm on Apache O_O
And that cause the IF statement to run the Fix for IIS

Anyway I've contact my web hosting company to figure that out...

comment:5 @RanY5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

OK i figure that out.
for security reasons $_SERVERREQUEST_URI?; output "IIS".
So I manually disable the part of the IIS Fix.

comment:6 @scribu5 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:7 @scribu5 years ago

  • Resolution set to worksforme
  • Status changed from reopened to closed

comment:8 @scribu5 years ago

  • Milestone Awaiting Review deleted

comment:9 @kirkpatrick5 years ago

A workaround:
list($clean_url) = explode("?",$_SERVER["REQUEST_URI"]);

Use $clean_url in place of $_SERVER["REQUEST_URI"]

This works for the presented problem. There may be other issues arising from this bug, though.

Note: See TracTickets for help on using tickets.