From e9b8b7feaf30fa1ef8b36fd3ce63e28a407b7def Mon Sep 17 00:00:00 2001
From: mattab <matthieu.aubry@gmail.com>
Date: Wed, 7 Oct 2015 15:53:57 +1300
Subject: [PATCH] Remove STRICT_TRANS_TABLES SQL mode to prevent fatal error

We cannot let tracking fail under any circumstance, but with STRICT_TRANS_TABLES, when a plugin is disabled, and the column is NOT NULL, then tracking would fail.

 Fixes #8853
---
 core/Db.php                          | 2 +-
 tests/PHPUnit/Integration/DbTest.php | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/core/Db.php b/core/Db.php
index 8a18f558d8..12798d2ff5 100644
--- a/core/Db.php
+++ b/core/Db.php
@@ -33,7 +33,7 @@ use Piwik\Db\Adapter;
  */
 class Db
 {
-    const SQL_MODE = 'STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_DATE,NO_ZERO_IN_DATE';
+    const SQL_MODE = 'ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ZERO_DATE,NO_ZERO_IN_DATE';
 
     private static $connection = null;
 
diff --git a/tests/PHPUnit/Integration/DbTest.php b/tests/PHPUnit/Integration/DbTest.php
index 486028fc21..ad37c61d3d 100644
--- a/tests/PHPUnit/Integration/DbTest.php
+++ b/tests/PHPUnit/Integration/DbTest.php
@@ -52,7 +52,8 @@ class DbTest extends IntegrationTestCase
         $this->assertInstanceOf($expectedClass, $db);
         $result = $db->fetchOne('SELECT @@SESSION.sql_mode');
 
-        $expected = 'NO_AUTO_VALUE_ON_ZERO,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER';
+        $expected = 'NO_AUTO_VALUE_ON_ZERO,
+        NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER';
         $this->assertSame($expected, $result);
     }
 
-- 
GitLab