diff --git a/classes/db/DbPDO.php b/classes/db/DbPDO.php index 96eef1137272c..d51e770a491a8 100644 --- a/classes/db/DbPDO.php +++ b/classes/db/DbPDO.php @@ -72,6 +72,8 @@ protected static function getPDO($host, $user, $password, $dbname, $timeout = 5) PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true, PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8mb4', PDO::MYSQL_ATTR_MULTI_STATEMENTS => _PS_ALLOW_MULTI_STATEMENTS_QUERIES_, + // FIX This option keeps all data as strings and stops automatic casting to integers, floats and other types + PDO::ATTR_STRINGIFY_FETCHES => true, ] ); } @@ -147,7 +149,7 @@ protected function _query($sql) { try { return $this->link->query($sql); - } catch (\PDOException $exception) { + } catch (PDOException $exception) { throw new PrestaShopException($exception->getMessage(), (int) $exception->getCode(), $exception); } }