Skip to content

Commit

Permalink
Merge pull request #52 from matomo-org/scriptnamenotdefined
Browse files Browse the repository at this point in the history
Prevent notice script_name not defined
  • Loading branch information
tsteur committed Dec 23, 2019
2 parents 172c68f + cabcdc4 commit 314e6d0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions PiwikTracker.php
Original file line number Diff line number Diff line change
Expand Up @@ -1811,11 +1811,13 @@ protected static function getCurrentScriptName()
}
}
}
if (empty($url)) {
if (empty($url) && isset($_SERVER['SCRIPT_NAME'])) {
$url = $_SERVER['SCRIPT_NAME'];
} elseif (empty($url)) {
$url = '/';
}

if ($url[0] !== '/') {
if (!empty($url) && $url[0] !== '/') {
$url = '/' . $url;
}

Expand Down

0 comments on commit 314e6d0

Please sign in to comment.