From: greg at freephile dot com Operating system: RH Linux 8.0 PHP version: 4.3.3 PHP Bug Type: HTTP related Bug description: _SERVER['REQUEST_URI'] does not capture fragment
Description: ------------ When a URI includes a fragment, that fragment is not captured as part of the $_SERVER['REQUEST_URI'] variable, so it is not possible to use parse_url() to get the fragment. As an example, the following request will NOT have the fragment in the $_SERVER['REQUEST_URI'] variable: http://www.freephile.com/admin/test.php?foo=bar#fragment Instead, the $_SERVER['REQUEST_URI'] is given as '/admin/test.php?foo=bar' I use PHP to process outgoing site links on http://www.buzgate.org, but due to this problem, I cannot redirect to external URIs containing a fragment. The workaround is to recode those URIs into two querystring variables and then reconstruct the URI: to=http://somewhere.com/somepage.html&fragment=named_anchor $externalSiteURI = $_REQUEST['to'] . $_REQUEST['fragment']; Reproduce code: --------------- See http://www.freephile.com/admin/test.php?foo=bar#fragment and http://buzgate.org/referral.php?to=http://www.sba.gov/library/pubs.html#success4 (this link may be fixed with a workaround by the time you get this message) Expected result: ---------------- $_SERVER['REQUEST_URI'] = '/admin/test.php?foo=bar#fragment' Actual result: -------------- $_SERVER['REQUEST_URI'] = '/admin/test.php?foo=bar' -- Edit bug report at http://bugs.php.net/?id=25804&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=25804&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=25804&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=25804&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=25804&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=25804&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=25804&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=25804&r=support Expected behavior: http://bugs.php.net/fix.php?id=25804&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=25804&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=25804&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=25804&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25804&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=25804&r=dst IIS Stability: http://bugs.php.net/fix.php?id=25804&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=25804&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=25804&r=float