Mantis Bug Tracker
 

View Issue Details Jump to Notes ] Wiki ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011534mantisbtwebpagepublic2010-02-23 05:482010-04-23 14:30
Reporterbmencke 
Assigned Tojreese 
PrioritylowSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version1.2.0 
Target Version1.2.1Fixed in Version1.2.1 
Summary0011534: Incorrect url/path detection
DescriptionUpgraded to Mantis 1.2.0 (stable) and noticed, that in my url appears a doubleslash.

The url looks like this: http://mantis.example.com//my_view_page.php [^]
TagsNo tags attached.
Attached Files

- Relationships
has duplicate 0011796resolvedatrol Separator char in link 
has duplicate 0011809resolvedatrol Wrong paths 
has duplicate 0009577resolvedjreese "Wrong" Links when using symlink for Mantis directory 
has duplicate 0010652resolvedjreese Clean install returns errors if Mantis installed in root 
has duplicate 0011700resolvedjreese Root path is incorrect in rendered html 
related to 0011917new CSS not working on pages in /admin 

-  Notes
User avatar (0024466)
bmencke (reporter)
2010-02-23 06:24
edited on: 2010-02-23 06:24

Tried to open mantis via firefox 3.6. Page does not display correctly.
No Images and url looks very freaky: http://mantis.example.com/\/my_view_page.php [^]

User avatar (0024472)
atrol (developer)
2010-02-23 08:40

First check whether your config_inc.php contains anything of your old installation which must not longer be set there. (especially any paths)

A virgin config_inc.php of 1.2.0 contains nothing more than something like
<?php
    $g_hostname = 'localhost';
    $g_db_type = 'mysql';
    $g_database_name = 'bugtracker';
    $g_db_username = 'root';
    $g_db_password = '';
?>

You should also check the settings of
_SERVER["SCRIPT_NAME"] and
_SERVER["DOCUMENT_ROOT"]
with phpinfo();

Is your server running Windows?
User avatar (0024473)
bmencke (reporter)
2010-02-23 08:49

Okay checked. Variables containig this:

SCRIPT_NAME /phpinfo.php
DOCUMENT_ROOT C:/WebServices/xampplite/htdocs/mantis

and yes my server is running under windows. its a basic xampp 1.7.3 installation
User avatar (0024479)
bmencke (reporter)
2010-02-24 04:47
edited on: 2010-02-24 06:34

Okay i solved my problem with moving mantis to a subfolder.
So my url is now: http://mantis.example.com/bugtracking/my_view_page.php [^]
But thats only a workaround.

User avatar (0024489)
jreese (administrator)
2010-02-24 11:51

This is a problem with the URL guessing algorithms duplicating the trailing /. IN the mean time, if you explicitly set $g_path in your config_inc to http://mantis.example.com [^] without the trailing slash, that should fix the problem for your installation.

Targetting a proper fix for next 1.2 release.
User avatar (0024507)
dhx (developer)
2010-02-25 01:26

I vote that we remove the automatic path/URL stuff from config_defaults_inc.php and instead integrate it into the installer somehow?
User avatar (0024728)
atrol (developer)
2010-03-12 11:49
edited on: 2010-03-12 11:50

I am no specialist of PHP and tbh until now not really knowing how sessions are working or what require_once exactly means.

If I understand the idea of dhx, the code which runs now for every session should run only one time during install.

I like the idea of having the lowest base overhead per request which is possible.

At the other side there will be a loss of convenience for the administrator (when moving an installation, changing protocol, ...)
If this would be the only disadvantage, I see no reason why this should not be changed

Keep in mind that one instance of MantisBT might be connected over http _and_ https, so $t_protocol variable will be set different during runtime.
Maybe this is a stopper for your idea?

@dhx: would be nice if you could explain me (or provide a good link for a short description of the concepts) how often the code in config_defaults_inc.php is interpreted in the current implementation, for example when am user logs in, enters an issue, after that views another issues, ...

User avatar (0024757)
jreese (administrator)
2010-03-15 13:50

I'm personally against removing the path/url detection. There are multiple use cases for being able to detect this on the fly, mostly useful for sites with multiple entry points with different URLs.

For instance, I work with a site that exposes a single tracker via multiple domains and protocols. "Internal" access over the local subnet uses a url like http://server/mantis/, [^] and external user access uses urls like https://domain1.com/mantis/ [^] and https://bugs.domain2.com/. [^] Without being able to detect those paths on the fly, this sort of usage would not be possible.

Honestly, it just needs to have someone sit down and fix some of the edge cases, and then it should work just fine. Hopefully I can do so in the near future.
User avatar (0024881)
DonSleza4e (reporter)
2010-03-23 12:26
edited on: 2010-03-23 12:27

http://www.mantisbt.org/bugs/view.php?id=11700 [^]

1)
I tried to add to config_inc.php
$g_path = 'http://bt.example.com'; [^]

On opening http://bt.example.com [^] system trying to open
http://bt.example.commy_view_page.php/ [^] (i.e. not valid url)

If I open directly http://bt.example.com/my_view_page.php/ [^]
I have lot of next stuff:
a) <link rel="stylesheet" type="text/css" href="\/css/default.css" />
b) <img border="0" alt="Mantis Bug Tracker" src="\/images/mantis_logo.gif" />
c) < a hr ef="http://bt.example.comissues_rss.php?username=......;project_id=3"> [^]
d) < a hr ef="\/view.php?id=107" title="....">0000107</ a>

2)
I tried to add to config_inc.php
$g_path = 'http://bt.example.com/'; [^]
a) - still same
b) - still same
c) - correct link now
d) - same

User avatar (0025152)
jreese (administrator)
2010-04-19 09:37

I believe I have a proper fix for this problem. I've pushed the fix to my proposal repo [1] and would like some feedback on the patch, especially from anyone running MantisBT on a Windows server or IIS.

[1] http://git.mantisforge.org/w/mantisbt/jreese.git?a=commit;h=2a5a0bc17f72e2cdf560fd4a4f912c5d5e7c3665 [^]
User avatar (0025155)
jreese (administrator)
2010-04-19 12:14

Fix committed to 1.2.x and master branches.

- Related Changesets
MantisBT: master-1.2.x 0fc80e9f
Timestamp: 2010-04-19 13:28:34
Author: jreese
Committer: John Reese
Details ] Diff ]
Fix 0011534: Incorrect path/short_path detection

Rather than attempting to try and decipher the path and short_path by
comparing the file's location on the filesytem with the document_root,
MantisBT should be looking at the PHP_SELF server var provided by PHP.
This variable is based on the current URL used to access the file, and
is not confused by symlinks or the document_root pointing directly to
the installation. It is also much simpler than the old method.

Tested on Linux and Windows with the following setups:
 - installed as subdomain, eg http://mantis.host/foo.php [^]
 - installed in subdirectory, eg http://host/mantisbt/foo.php [^]
 - accessed by symlink (Linux), eg http://host/mantis/foo.php [^]
   where /var/www/mantis -> /usr/share/mantisbt
mod - config_defaults_inc.php Diff ] File ]
MantisBT: master 5ac1fdf3
Timestamp: 2010-04-19 13:28:34
Author: jreese
Committer: John Reese
Details ] Diff ]
Fix 0011534: Incorrect path/short_path detection

Rather than attempting to try and decipher the path and short_path by
comparing the file's location on the filesytem with the document_root,
MantisBT should be looking at the PHP_SELF server var provided by PHP.
This variable is based on the current URL used to access the file, and
is not confused by symlinks or the document_root pointing directly to
the installation. It is also much simpler than the old method.

Tested on Linux and Windows with the following setups:
 - installed as subdomain, eg http://mantis.host/foo.php [^]
 - installed in subdirectory, eg http://host/mantisbt/foo.php [^]
 - accessed by symlink (Linux), eg http://host/mantis/foo.php [^]
   where /var/www/mantis -> /usr/share/mantisbt
mod - config_defaults_inc.php Diff ] File ]

- Issue History
Date Modified Username Field Change
2010-02-23 05:48 bmencke New Issue
2010-02-23 05:49 bmencke Issue Monitored: bmencke
2010-02-23 05:49 bmencke Issue End Monitor: bmencke
2010-02-23 06:24 bmencke Note Added: 0024466
2010-02-23 06:24 bmencke Note Edited: 0024466 View Revisions
2010-02-23 08:40 atrol Note Added: 0024472
2010-02-23 08:40 atrol Status new => feedback
2010-02-23 08:49 bmencke Note Added: 0024473
2010-02-23 08:49 bmencke Status feedback => new
2010-02-24 04:47 bmencke Note Added: 0024479
2010-02-24 06:34 bmencke Note Edited: 0024479 View Revisions
2010-02-24 11:51 jreese Note Added: 0024489
2010-02-24 11:51 jreese Status new => confirmed
2010-02-25 01:26 dhx Note Added: 0024507
2010-02-25 01:26 dhx Issue Monitored: dhx
2010-03-12 09:57 dhx Target Version => 1.2.2
2010-03-12 11:49 atrol Note Added: 0024728
2010-03-12 11:50 atrol Note Edited: 0024728 View Revisions
2010-03-15 13:50 jreese Note Added: 0024757
2010-03-23 12:26 DonSleza4e Note Added: 0024881
2010-03-23 12:27 DonSleza4e Note Edited: 0024881 View Revisions
2010-03-23 12:27 DonSleza4e Note Edited: 0024881 View Revisions
2010-04-14 04:25 atrol Relationship added has duplicate 0011796
2010-04-19 05:23 atrol Relationship added has duplicate 0011809
2010-04-19 09:37 jreese Note Added: 0025152
2010-04-19 12:00 jreese Assigned To => jreese
2010-04-19 12:00 jreese Resolution open => fixed
2010-04-19 12:00 jreese Fixed in Version => 1.3.x
2010-04-19 12:00 jreese Changeset attached MantisBT master-1.2.x 0fc80e9f =>
2010-04-19 12:00 jreese Changeset attached MantisBT master 5ac1fdf3 =>
2010-04-19 12:14 jreese Note Added: 0025155
2010-04-19 12:14 jreese Status confirmed => resolved
2010-04-19 12:14 jreese Fixed in Version 1.3.x => 1.2.2
2010-04-22 09:56 jreese Summary Url doubleslash => Incorrect url/path detection
2010-04-22 09:57 jreese Relationship added has duplicate 0009577
2010-04-22 15:14 jreese Relationship added has duplicate 0010652
2010-04-22 15:14 jreese Issue Monitored: andy_mbt
2010-04-22 15:14 jreese Relationship added has duplicate 0011700
2010-04-23 14:30 jreese Status resolved => closed
2010-05-11 23:41 dhx Relationship added related to 0011917


MantisBT 1.2.2 git master-1.2.x[^]
Copyright © 2000 - 2010 MantisBT Group
Time: 0.2640 seconds.
memory usage: 2,056 KB
Powered by Mantis Bugtracker