DB attribute length bug


(mvolpe) #1

In running version 0.2.28, after a successful install, I was experiencing the following bug, found in the Apache web log server:

PHP Fatal error: Uncaught exception ‘Exception’ with message ‘Error query: SQLSTATE[HY000]: General error: 1406 Data too long for column ‘location_browser_lang’ at row 1’ in C:\Web\piwik\core\Tracker\Db.php:193\nStack trace:\n#0 C:\Web\piwik\core\Tracker\Visit.php(243): Piwik_Tracker_Db->query(‘INSERT INTO piw…’, Array)\n#1 C:\Web\piwik\core\Tracker\Visit.php(105): Piwik_Tracker_Visit->handleNewVisit(‘1’, false)\n#2 C:\Web\piwik\core\Tracker.php(60): Piwik_Tracker_Visit->handle()\n#3 C:\Web\piwik\piwik.php(47): Piwik_Tracker->main()\n#4 {main}\n thrown in C:\Web\piwik\core\Tracker\Db.php on line 193, referer: http://rd.virgilio.it/tilab/demo/Demo/menu.html

I found the bug was due to a too short ‘location_browser_lang’ DB attribute, declared as VARCHAR(20) in the file /core/Piwik.php:

location_browser_lang VARCHAR(20) NOT NULL,

Modifying it to:

location_browser_lang VARCHAR(50) NOT NULL,

and possibly to an even larger value (i.e. 100) everything worked fine

– Michele


(Matthieu Aubry) #2

thanks for report, fixed in SVN: http://dev.piwik.org/trac/changeset/859
apply patch or wait until next release.