cPanel / WHM and MariaDB 10 — STRICT_TRANS_TABLES

I’ve been migrating sites from CloudLinux cPanel (WHM 54) boxes running MySQL 5.6 to a CloudLinux cPanel box running MariaDB 10.

I was migrating an old Joomla 1.5.26 site (using PHP 5.3 from PHP Selector) and ran into a situation when attempting to upload a bulletin to the Joomla site.   I’d get through the process of uploading the bulletin (via docman), and when I’d go to save it I would be directed to a blank white screen.    Although it was a blank screen, it would show the error if you viewed the source of the blank page.

alert(‘mosDMDocument::store failed – Incorrect datetime value: ” for column ‘checked_out_time’ at row 1 SQL=INSERT INTO `jos_docman` ( `id`,`catid`,`dmname`,`dmfilename`,`dmdescription`,`dmdate_published`,`dmowner`,`published`,`dmurl`,`dmcounter`,`checked_out`,`checked_out_time`,`approved`,`dmthumbnail`,`dmlastupdateon`,`dmlastupdateby`,`dmsubmitedby`,`dmmantainedby`,`dmlicense_id`,`dmlicense_display`,`access`,`attribs` ) VALUES ( ‘0’,’5′,’COH’,’COH.pdf’,'<p>Test 123</p>’,’2016-02-21 23:33:50′,’-1′,’0′,”,’0′,’0′,”,’1′,”,’2016-02-21 23:34:37′,’62’,’62’,’-6′,’0′,’0′,’0′,’crc_checksum=\nmd5_checksum=’ )’); window.history.go(-1);

It was attempting to store an incorrect value in checked_out_time.   I think it either had to be in valid datetime format or had to be 0 or NULL.   Instead, it was trying to store nothing at all.

As it turns out, when you switch to MariaDB in WHM, the following sql_mode is set in /usr/my.cnf:

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

In my case, I had a bunch of Joomla 1.5.x and 2.5.x sites to migrate and really needed to not have issues with docman.    So I changed the sql_mode in /usr/my.cnf to:

sql_mode=NO_ENGINE_SUBSTITUTION,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO

I restarted MariaDB and the bulletin upload functions worked fine.

I obviously would not advise anybody to remove STRICT_TRANS_TABLES  from sql_mode.    I’m betting newer versions of Joomla’s docman stuff likely is not broken like this version of docman is and thus would not trigger an error.    Much better than lessening the security of your MariaDB install would be to simply upgrade to the latest greatest Joomla / component version.   Easier said than done.   Have you ever tried to upgrade a fully customized Joomla site populated with a lot of content to a new major version (or two in this case)?    Joomla sucks.  I don’t use it — I just support it.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.