Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.15

Bug #10054 Script on http://example.org/ defaults to http://example.org/index.php
Submitted: 2007-02-08 13:36 UTC
From: schmidt Assigned: davidc
Status: Bogus Package: Net_URL (version 1.0.14)
PHP Version: 5.1.4 OS: Linux
Roadmaps: 1.0.15    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 41 + 41 = ?

 
 [2007-02-08 13:36 UTC] schmidt (Christian Schmidt)
Description: ------------ When calling the constructor for Net_URL() without any arguments, an instance pointing to the current URL is created. However, when the current page is accessed "like a directory", e.g. http://example.org/, the instance still points to http://example.org/index.php, even though this URL isn't visible to the user. The reason for this is that the constructor uses $_SERVER[PHP_SELF]. I think a better approach would be to use $_SERVER[REQUEST_URI] if it is defined (I don't know whether it is Apache specific). Test script: Put the following script in a file called index.php (assuming that index.php is included in DirectoryIndex in Apache). Test script: --------------- require_once 'Net/URL.php'; $url = new Net_URL(); echo $url->getUrl(); Expected result: ---------------- http://example.org/ Actual result: -------------- http://example.org/index.php

Comments

 [2007-05-07 22:39 UTC] davidc (David Coallier)
Depends what you are expecting.. Resolved URL or Initial URL. Personally the url called is not bogus as this is the resolved url (as you can see in the headers) But I also find it bogus as it is not what you are accessing of course..
 [2007-05-07 22:40 UTC] davidc (David Coallier)
I am marking this as bogus as it can be both options.
 [2007-05-08 21:52 UTC] schmidt (Christian Schmidt)
In that case I suggest adding a method for retrieving the current URL, i.e. the URL requested by the user. In general I think this is more useful than any "resolved" URLs. In a configuration that uses mod_rewrite, Alias etc., it seems unclear what exactly a "resolved URL" is.