View Issue Details

IDProjectCategoryView StatusLast Update
0011534mantisbtwebpagepublic2010-04-23 14:30
Reporterbmencke Assigned Tojreese  
PrioritylowSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.0 
Target Version1.2.1Fixed in Version1.2.1 
Summary0011534: Incorrect url/path detection
Description

Upgraded 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.

Relationships

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

Activities

bmencke

bmencke

2010-02-23 06:24

reporter   ~0024466

Last edited: 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

atrol

atrol

2010-02-23 08:40

developer   ~0024472

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?

bmencke

bmencke

2010-02-23 08:49

reporter   ~0024473

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

bmencke

bmencke

2010-02-24 04:47

reporter   ~0024479

Last edited: 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.

jreese

jreese

2010-02-24 11:51

reporter   ~0024489

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.

dhx

dhx

2010-02-25 01:26

reporter   ~0024507

I vote that we remove the automatic path/URL stuff from config_defaults_inc.php and instead integrate it into the installer somehow?

atrol

atrol

2010-03-12 11:49

developer   ~0024728

Last edited: 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, ...

jreese

jreese

2010-03-15 13:50

reporter   ~0024757

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.

DonSleza4e

DonSleza4e

2010-03-23 12:26

reporter   ~0024881

Last edited: 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

jreese

jreese

2010-04-19 09:37

reporter   ~0025152

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

jreese

jreese

2010-04-19 12:14

reporter   ~0025155

Fix committed to 1.2.x and master branches.

Related Changesets

MantisBT: master-1.2.x 0fc80e9f

2010-04-19 09:28

jreese


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
Affected Issues
0011534
mod - config_defaults_inc.php Diff File

MantisBT: master 5ac1fdf3

2010-04-19 09:28

jreese


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
Affected Issues
0011534
mod - config_defaults_inc.php Diff File