#15209 closed defect (bug) (worksforme)
$_SERVER['REQUEST_URI'] Doesn't always work correctly
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
I had problems with links in the admin panel.
Some of the Query Vars returned twice.
The Normal Link should be:
wp-admin/edit.php?post_type=page&paged=2
But it appears as:
wp-admin/edit.php?post_type=page?post_type=page&paged=2
And that broke the link. the solution is to use
$GLOBALS['HTTP_SERVER_VARS']['REQUEST_URI'];
Instead of
$_SERVER['REQUEST_URI'];
I've changed all the $_SERVERREQUEST_URI? in functions.php and All works!
Source for the solution:
http://ckon.wordpress.com/2006/08/09/server-request_uri-doesnt-always-work-correctly-heres-how-to-fix/
Change History (9)
#2
@
15 years ago
I would wager a guess and say that the person is still using PHP4, probably PHP4.2.
#3
@
15 years ago
Actually I'm using PHP5.
echo $_SERVER['REQUEST_URI']; wp_fix_server_vars(); echo '<br />' . $_SERVER['REQUEST_URI']; exit();
Results:
/wp-admin/edit.php?post_type=page /wp-admin/edit.php?post_type=page?post_type=page
#4
@
15 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...
#5
@
15 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.
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?