diff options
author | Thomas Steur <thomas.steur@googlemail.com> | 2014-07-18 19:22:33 +0400 |
---|---|---|
committer | Thomas Steur <thomas.steur@googlemail.com> | 2014-07-18 19:22:33 +0400 |
commit | 46381839b0ce17d854b5fbbc07a38ba2b1de324f (patch) | |
tree | 76b709ffe911d1da7aa5f0907ffb07750c2eea95 /core/Piwik.php | |
parent | d22f486081cf14a6ca55319652ecf3b4e625e7f3 (diff) |
fixes #5841 fix Uninitialized string offset if custom variable is an empty string
Diffstat (limited to 'core/Piwik.php')
-rw-r--r-- | core/Piwik.php | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/Piwik.php b/core/Piwik.php index d1baf061ff..e2f1733cd4 100644 --- a/core/Piwik.php +++ b/core/Piwik.php @@ -151,10 +151,15 @@ class Piwik $options .= self::getJavascriptTagOptions($idSite, $mergeSubdomains, $mergeAliasUrls); } $maxCustomVars = Plugins\CustomVariables\CustomVariables::getMaxCustomVariables(); + if ($visitorCustomVariables) { $options .= ' // you can set up to ' . $maxCustomVars . ' custom variables for each visitor' . PHP_EOL; $index = 1; foreach ($visitorCustomVariables as $visitorCustomVariable) { + if (empty($visitorCustomVariable)) { + continue; + } + $options .= ' _paq.push(["setCustomVariable", '.$index++.', "'.$visitorCustomVariable[0].'", "'.$visitorCustomVariable[1].'", "visit"]);' . PHP_EOL; } } @@ -162,6 +167,9 @@ class Piwik $options .= ' // you can set up to ' . $maxCustomVars . ' custom variables for each action (page view, download, click, site search)' . PHP_EOL; $index = 1; foreach ($pageCustomVariables as $pageCustomVariable) { + if (empty($pageCustomVariable)) { + continue; + } $options .= ' _paq.push(["setCustomVariable", '.$index++.', "'.$pageCustomVariable[0].'", "'.$pageCustomVariable[1].'", "page"]);' . PHP_EOL; } } |