Encode non-utf-8 symbols in keys

This commit is contained in:
Alexander Pankratov 2020-08-31 02:30:41 +03:00
parent b90e92ee68
commit 2f81a14b95
2 changed files with 14 additions and 0 deletions

View File

@ -353,6 +353,13 @@ class MysqlArray implements DbArray
return []; return [];
} }
if (
!empty($params['index'])
&& !mb_check_encoding($params['index'], 'UTF-8')
) {
$params['index'] = mb_convert_encoding($params['index'], 'UTF-8');
}
try { try {
$request = yield $this->db->execute($query, $params); $request = yield $this->db->execute($query, $params);
} catch (\Throwable $e) { } catch (\Throwable $e) {

View File

@ -365,6 +365,13 @@ class PostgresArray implements DbArray
return []; return [];
} }
if (
!empty($params['index'])
&& !mb_check_encoding($params['index'], 'UTF-8')
) {
$params['index'] = mb_convert_encoding($params['index'], 'UTF-8');
}
try { try {
$request = yield $this->db->execute($query, $params); $request = yield $this->db->execute($query, $params);
} catch (\Throwable $e) { } catch (\Throwable $e) {