A free, self-hostable news aggregator…
SQL attributes native unicode (#5371)
Alexandre Alapetitefde4e79ed0b8
diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.phpindex 98d45733c..e89ceb773 100644--- a/app/Models/CategoryDAO.php+++ b/app/Models/CategoryDAO.php@@ -60,7 +60,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {continue;}if (!($stm->bindValue(':id', $feed['id'], PDO::PARAM_INT) &&- $stm->bindValue(':attributes', json_encode($attributes, JSON_UNESCAPED_SLASHES)) &&+ $stm->bindValue(':attributes', json_encode($attributes, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)) &&$stm->execute())) {Minz_Log::error('SQL error ' . __METHOD__ . json_encode($stm->errorInfo()));}@@ -118,7 +118,7 @@ SQL;$values = array($valuesTmp['kind'] ?? FreshRSS_Category::KIND_NORMAL,$valuesTmp['name'],- is_string($valuesTmp['attributes']) ? $valuesTmp['attributes'] : json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES),+ is_string($valuesTmp['attributes']) ? $valuesTmp['attributes'] : json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),$valuesTmp['name'],);@@ -169,7 +169,7 @@ SQL;$values = array($valuesTmp['name'],$valuesTmp['kind'] ?? FreshRSS_Category::KIND_NORMAL,- is_string($valuesTmp['attributes']) ? $valuesTmp['attributes'] : json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES),+ is_string($valuesTmp['attributes']) ? $valuesTmp['attributes'] : json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),$id,$valuesTmp['name'],);diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.phpindex 3ef3254b0..36d633c6e 100644--- a/app/Models/EntryDAO.php+++ b/app/Models/EntryDAO.php@@ -169,7 +169,7 @@ SQL;$valuesTmp['attributes'] = [];}$this->addEntryPrepared->bindValue(':attributes', is_string($valuesTmp['attributes']) ? $valuesTmp['attributes'] :- json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES));+ json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));if (static::hasNativeHex()) {$this->addEntryPrepared->bindParam(':hash', $valuesTmp['hash']);@@ -280,7 +280,7 @@ SQL;$valuesTmp['attributes'] = [];}$this->updateEntryPrepared->bindValue(':attributes', is_string($valuesTmp['attributes']) ? $valuesTmp['attributes'] :- json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES));+ json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));if (static::hasNativeHex()) {$this->updateEntryPrepared->bindParam(':hash', $valuesTmp['hash']);diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.phpindex 7819bf9b5..12597b46c 100644--- a/app/Models/FeedDAO.php+++ b/app/Models/FeedDAO.php@@ -66,7 +66,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo {base64_encode($valuesTmp['httpAuth']),isset($valuesTmp['error']) ? intval($valuesTmp['error']) : 0,isset($valuesTmp['ttl']) ? intval($valuesTmp['ttl']) : FreshRSS_Feed::TTL_DEFAULT,- is_string($valuesTmp['attributes']) ? $valuesTmp['attributes'] : json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES),+ is_string($valuesTmp['attributes']) ? $valuesTmp['attributes'] : json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),);if ($stm !== false && $stm->execute($values)) {diff --git a/app/Models/TagDAO.php b/app/Models/TagDAO.phpindex 133907a3a..32f67f0ab 100644--- a/app/Models/TagDAO.php+++ b/app/Models/TagDAO.php@@ -62,7 +62,7 @@ SQL;}$values = array($valuesTmp['name'],- is_string($valuesTmp['attributes']) ? $valuesTmp['attributes'] : json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES),+ is_string($valuesTmp['attributes']) ? $valuesTmp['attributes'] : json_encode($valuesTmp['attributes'], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE),$valuesTmp['name'],);@@ -120,7 +120,7 @@ SQL;$stm = $this->pdo->prepare($sql);if ($stm !== false &&$stm->bindValue(':id', $id, PDO::PARAM_INT) &&- $stm->bindValue(':attributes', json_encode($attributes, JSON_UNESCAPED_SLASHES), PDO::PARAM_STR) &&+ $stm->bindValue(':attributes', json_encode($attributes, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE), PDO::PARAM_STR) &&$stm->execute()) {return $stm->rowCount();}