DSB/MySQLDumper

MSD 1.24.4: str_replace issue if path contains 'inc'

darnux opened this issue · 2 comments

In: inc/functions_global.php on function Realpfad there is a str_replace call which removes the string 'inc' from path.

function Realpfad($p) { global $config; $dir=dirname(__FILE__); $dir=str_replace('inc','',$dir); $dir=str_replace('\\','/',$dir); $dir=str_replace('//','/',$dir); if (substr($dir,-1)!='/') $dir.='/'; return $dir; }
This causes problems if you have this string mentioned in your path, e.g.:

/var/www/distinct/mysqldumper/

will be replaced to:

/var/www/distt/mysqldumper/

which results in an endless loop later on because the path does not exist on the system usually ;-)
A quick & dirty fix which resolved it for me was:

$dir=str_replace('/inc','',$dir);

the "/inc" is not used elsewhere in my path so it works, but it wouldn't work if somebody uses:

/var/www/incasdf/mysqldumper/

for example.

DSB commented

True.
$dir=str_replace('/inc/','',$dir); should also do the trick. Feel free to send a pull request since I don't maintain this project any more but accept pr's.

DSB commented

This should be fixed with the latest commits. If you discover any more issues please with this open a new issue.