Error in /libs/PiwikTracker/PiwikTracker.php function getCookieMatchingName


#1

My code:


require_once(PIWIK . 'libs/PiwikTracker/PiwikTracker.php');
\PiwikTracker::$URL = '//mysite/piwik/';
$tracker = new \PiwikTracker($site_id, '//mysite/piwik/');

$tracker->setTokenAuth($token);
$tracker->setUrl($var['url']);
$tracker->doTrackPageView($var['title']);
$tracker->setCustomVariable(1, 'user', $username, 'visit');

Upon reaching $tracker = new \PiwikTracker($site_id, ‘//mysite/piwik/’), I’m receiving the error:

It appears $_COOKIE is empty, which is why the foreach is bombing - is it supposed to be? I’m using v 2.9.1. I’ve spent an entire day troubleshooting and am a bit beside myself. Thanks in advance for any suggestions.


(Matthieu Aubry) #2

Hi there,

Thanks for the report. the bug was fixed in: Prevent Warning: Invalid argument supplied for foreach() in /[removed… · matomo-org/piwik-php-tracker@84a994a · GitHub


#3

Thank you.