php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23829 header ("Location: test.php?this=5&that=6#goToThisBookmark"); err with bookmark
Submitted: 2003-05-27 08:37 UTC Modified: 2003-05-27 09:29 UTC
From: MDonatas at centras dot lt Assigned:
Status: Not a bug Package: *URL Functions
PHP Version: 4.3.1 OS: Windows 2000 Server
Private report: No CVE-ID: None
 [2003-05-27 08:37 UTC] MDonatas at centras dot lt
I'll make it clear with 3 small webpages in my example on how to reproduce this bug.

*******test1.php********
<html>
<head>
  <title></title>
</head>
<body>
<a href="test2.php">Go to test2.php</a>
</body>
</html>
************************

*******test2.php********
<?php
  header ("Location: test3.php?this=5&that=6#MyBookmark");
?>
************************

*******test3.php********
<html>
<head>
  <title></title>
</head>
<body>
<?php
  var_dump ($HTTP_GET_VARS);
?>
</body>
</html>
************************

Now, first part of the test:
Run test2.php so you would get redirected to test3.php
OUTPUT in test3.php :: array(2) { ["this"]=> string(1) "5" ["that"]=> string(1) "6" }
Everything is fine here, now second part of the test.

Run test1.php and click on the link to go to test2.php and instantly get redirected to test3.php
OUTPUT in test3.php :: array(2) { ["this"]=> string(1) "5" ["that"]=> string(12) "6#MyBookmark" }

See, there is bookmark thingy attached at the end as if it is a part of my second variable sent over GET vie the link.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-27 08:47 UTC] rasmus@php.net
Looks like a browser bug to me.  Which browser are you using?
Browsers don't actually send the #foo across the wire, they simply remember it and scroll down to the location of the <a name> tag when they find it.
 [2003-05-27 09:09 UTC] MDonatas at centras dot lt
I am using IE 6.0.2600.0000
Tried the same with Netscape Communicator 4.7 and it worked remarkably well.

BUT! This issues has just been tested with ASP, and it worked, all variables were sent as they should have been sent and the page scrolled to the right bookmark.
SO, there is something on your end too.
 [2003-05-27 09:29 UTC] rasmus@php.net
No, I don't think you understand.  If the browser actually sends this anchor data, by encoding it, or by whatever means, then PHP is bound to show this to you.  PHP could not possibly take that bookmark data and scroll the page to the appropriate place for you.  That's a client-side function.  And by the way, I tested this on IE 6.0.2800.xxx and it doesn't happen with that browser.  
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Aug 01 08:01:24 2021 UTC