Daniel-KM / Omeka-plugin-Stats

Plugin for Omeka that counts views of pages in order to know the least popular record and the most viewed pages. It provides useful infos on visitors too (language, referrer...). So this is an analytics tool like Piwik, Google Analytics and other hundreds of such web loggers, but integrated and adapted.
10 stars 2 forks source link

Mysqli statement execute error : Data too long for column 'referrer' at row 1 #14

Open DBinaghi opened 3 years ago

DBinaghi commented 3 years ago

Error seems to be triggered by too long an URL of referral page (f.i., when trying to perform a second search after displaying the results of an advanced search one).

Here's the error log:

exception 'Zend_Db_Statement_Mysqli_Exception' with message 'Mysqli statement execute error : Data too long for column 'referrer' at row 1' in /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/Db/Statement/Mysqli.php:215
Stack trace:
#0 /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/Db/Statement.php(303): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#2 [internal function]: Zend_Db_Adapter_Abstract->query('INSERT INTO `om...', Array)
#3 /web/htdocs/www.bitoteko.it/home/application/libraries/Omeka/Db.php(80): call_user_func_array(Array, Array)
#4 /web/htdocs/www.bitoteko.it/home/application/libraries/Omeka/Db.php(257): Omeka_Db->__call('query', Array)
#5 /web/htdocs/www.bitoteko.it/home/application/libraries/Omeka/Db.php(257): Omeka_Db->query('INSERT INTO `om...', Array)
#6 /web/htdocs/www.bitoteko.it/home/application/libraries/Omeka/Record/AbstractRecord.php(541): Omeka_Db->insert('Hit', Array)
#7 /web/htdocs/www.bitoteko.it/home/plugins/Stats/StatsPlugin.php(824): Omeka_Record_AbstractRecord->save()
#8 /web/htdocs/www.bitoteko.it/home/plugins/Stats/StatsPlugin.php(333): StatsPlugin->_logCurrentPage()
#9 [internal function]: StatsPlugin->hookPublicHead(Array)
#10 /web/htdocs/www.bitoteko.it/home/application/libraries/Omeka/Plugin/Broker.php(154): call_user_func(Array, Array)
#11 /web/htdocs/www.bitoteko.it/home/application/libraries/globals.php(188): Omeka_Plugin_Broker->callHook('public_head', Array)
#12 /web/htdocs/www.bitoteko.it/home/themes/default/common/header.php(28): fire_plugin_hook('public_head', Array)
#13 /web/htdocs/www.bitoteko.it/home/application/libraries/Omeka/View.php(114): include('/web/htdocs/www...')
#14 /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/View/Abstract.php(888): Omeka_View->_run('/web/htdocs/www...')
#15 /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/View/Helper/Partial.php(109): Zend_View_Abstract->render('common/header.p...')
#16 [internal function]: Zend_View_Helper_Partial->partial('common/header.p...', Array)
#17 /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/View/Abstract.php(350): call_user_func_array(Array, Array)
#18 /web/htdocs/www.bitoteko.it/home/application/libraries/globals.php(1665): Zend_View_Abstract->__call('partial', Array)
#19 /web/htdocs/www.bitoteko.it/home/application/libraries/globals.php(1665): Omeka_View->partial('common/header.p...', Array)
#20 /web/htdocs/www.bitoteko.it/home/application/libraries/globals.php(1679): common('header', Array)
#21 /web/htdocs/www.bitoteko.it/home/themes/default/search/index.php(3): head(Array)
#22 /web/htdocs/www.bitoteko.it/home/application/libraries/Omeka/View.php(114): include('/web/htdocs/www...')
#23 /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/View/Abstract.php(888): Omeka_View->_run('/web/htdocs/www...')
#24 /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(912): Zend_View_Abstract->render('search/index.ph...')
#25 /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(933): Zend_Controller_Action_Helper_ViewRenderer->renderScript('search/index.ph...', NULL)
#26 /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/Controller/Action/Helper/ViewRenderer.php(972): Zend_Controller_Action_Helper_ViewRenderer->render()
#27 /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/Controller/Action/HelperBroker.php(277): Zend_Controller_Action_Helper_ViewRenderer->postDispatch()
#28 /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/Controller/Action.php(527): Zend_Controller_Action_HelperBroker->notifyPostDispatch()
#29 /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('indexAction')
#30 /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#31 /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(105): Zend_Controller_Front->dispatch()
#32 /web/htdocs/www.bitoteko.it/home/application/libraries/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
#33 /web/htdocs/www.bitoteko.it/home/application/libraries/Omeka/Application.php(73): Zend_Application->run()
#34 /web/htdocs/www.bitoteko.it/home/index.php(23): Omeka_Application->run()
#35 {main}
DBinaghi commented 3 years ago

Investigated a bit: the field referrer is created as a varchar(1024), but as soon as the length is over 255 the error raises. It seems varchar should not be used for fields larger than 255, maybe switching to another type could solve the problem.