Menu

#2975 (ok 3.2.6) Extraneus dot from dirname() when webroot

3.3.0
fixed
nobody
1
2013-06-11
2010-02-01
ayanamist
No

in the libraries/Config.class.php, line 665-683, there is a serious mistake. if you use www.example.com as PMA root dir, you access the url and login, the uri will become "www.example.com." which is appended with a unnecessary dot. the reason is that line 642-659 get $pma_absolute_uri = www.example.com, line 665-678 get $path = ".", so line 683 concat them as "www.example.com."
in fact, line 665-678 is the worst codes i have never seen. if you put your in www.example.com/pma, it will still generate $path = '.' because of line 676's two dirname. so it will redirect you to www.example.com./index.php?xxxxx but not www.example.com./pma/index.php?xxxx
bug is tested under nginx 8.32+php 5.2.12+php-fpm 0.6, just remove relevant codes will fix the problem.

Discussion

  • ayanamist

    ayanamist - 2010-02-01
    • status: open --> open-fixed
     
  • ayanamist

    ayanamist - 2010-02-01

    just add following:
    if ($path == '.') {
    $path = '';
    }
    after line 671 will temporarily solve the problem
    it seems that the problem exists only in firefox but not ie(i only test ie8)

     
  • ayanamist

    ayanamist - 2010-02-01

    This might happen due to a wrong value of the $cfg
    ['PmaAbsoluteUri'] directive. Please doublecheck if it is set like

    http://your-host/path_to_your_phpMyAdmin_installation/

    Maybe you have to URL-encode some illegal characters such as
    whitespaces and tildes (~) in the path.

     
  • Marc Delisle

    Marc Delisle - 2010-02-02
    • status: open-fixed --> open
     
  • Marc Delisle

    Marc Delisle - 2010-02-02
    • status: open --> pending
     
  • ayanamist

    ayanamist - 2010-02-03

    if you use IE, the browser will automatically eat the additional dot. so it does nothing.
    however, if you use Firefox, the browser will hold this unnecessary dot. and when page is redirected again with this dot in the same way its adding the dot (as i know login and drop table will induce the problem), it will be www.example.com.. which can't be resolved to a valid ip.
    you can imagine: i login and url become "www.example.com." and i drop a table and url become "www.example.com.." which is not a valid domain, so firefox tell me can't resolve the domain and throw an error. this is the problem.
    the bug is just affecting some browsers but not all.

     
  • ayanamist

    ayanamist - 2010-02-03
    • status: pending --> open
     
  • Herman van Rink

    Herman van Rink - 2010-02-03
    • summary: get a wrong PmaAbsoluteUri. --> Extraneus dot from dirname() when installed in root
     
  • Herman van Rink

    Herman van Rink - 2010-02-03

    Although I haven't reproduced this exactly the proposed fix seems reasonable. And the php.net docs confirm that dirname() returns a dot is $path does not contain a slash.

     
  • Herman van Rink

    Herman van Rink - 2010-02-03

    Committed as revision 13379 to go into 3.2.6

     
  • Herman van Rink

    Herman van Rink - 2010-02-03
    • summary: Extraneus dot from dirname() when installed in root --> (ok 3.2.6) Extraneus dot from dirname() when webroot
    • priority: 5 --> 1
    • status: open --> open-fixed
     
  • Marc Delisle

    Marc Delisle - 2010-03-08
    • status: open-fixed --> closed-fixed
     
  • Michal Čihař

    Michal Čihař - 2013-06-11
    • Status: closed-fixed --> fixed
     
MongoDB Logo MongoDB