Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
in Q2A Core by

I have two Q2A websites, moved to another server. The first works fine, but the second gave me some pain. Both are the same version 1.8.3.

I have this error alert when trying to do some basic stuff: A server error occurred - please try again.

It occurs, for example, when:

  1. I moderate questions and click the Reject button. As a response result of Ajax i get this in firebug:
    A server error occurred - please try again.

  2. When I hide or delete existing questions I get a WSOD page with an error:
    A Question2Answer database query failed when generating this page.
    A full description of the failure is available in the web server's error log file.

Error log says this:

PHP Question2Answer MySQL query error 1406: Data too long for column 'params' at row 1 - Query: INSERT INTO qa_eventlog (datetime, ipaddress, userid, handle, cookieid, event, params) VALUES (NOW(), 'IP ADDRESS', '1', 'USERNAME', NULL, 'q_hide', 'postid=719\tparentid=\tparent=\ttitle=test test test\tcontent=test\tformat=\ttext=test\ttags=\tcategoryid=17\tname=\toldquestion=array(72)\toldquestion_postid=719\toldquestion_categoryid=17\toldquestion_type=Q\toldquestion_basetype=Q\toldquestion_views=1\toldquestion_title=test test test\toldquestion_categoryname=General\toldquestion_categorybackpath=general-questions\toldquestion_categoryids=17,17\toldquestion_content=test\toldquestion_userid=1\toldquestion_level=120\toldquestion_email=email@gmail.com\toldquestion_handle=USERNAME\toldquestion_avatarblobid=2400542691130652300\toldquestion_avatarwidth=400\toldquestion_avatarheight=400\toldquestion_isbyuser=1\toldquestion_authorlast=1\toldquestion_viewable=1\toldquestion_answerbutton=1\toldquestion_commentbutton=1\toldquestion_commentable=1\toldquestion_editbutton=1\toldquestion_editable=1\toldquestion_retagcatable=1\toldquestion_aselectable=1\toldquestion_closeable=1\toldquestion_hideable=1'): /var/www/php-bin-isp-php74/site/php, referer: https://site.com/719/test-test-test

This happens only on one website, which is even less customized, than the other. The website is working fine on the old server.

I tried to investigate it and found, that I don't have the qa_eventlog table on the old server, but I have it on new. The reason was in "Log events to qa_eventlog database table" setting in Plugins > Event logging options (I had it turned off on the first website).

The 'params' column is limited to 800 chars when the request above contains 1714 characters. So I changed from varchar(800) to varchar(5000) and it fixed the problem.

But why did this error happen at all?

Q2A version: 1.8.3
As you can see in the image, when an array is received, then only something like this should be logged `array(17)`. However, in your case, that is not being logged and, instead, the array is somehow exploded in each of the items inside of it and generating redundant logging. Alternatively, a plugin is turning the array into text, so the check for `is_array()` is being bypassed.

Please log in or register to answer this question.