Skip to content

Commit 8163bf2

Browse files
committed
Fix escaped backslashes for SQLite
1 parent b02d457 commit 8163bf2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/UniqueTranslationValidator.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@ protected function findTranslation($connection, $table, $column, $locale, $value
231231
{
232232
// Properly escape backslashes to work with LIKE queries...
233233
// See: https://stackoverflow.com/questions/14926386/how-to-search-for-slash-in-mysql-and-why-escaping-not-required-for-wher
234-
$value = str_replace('\\', '\\\\\\\\', $value);
234+
$escaped = DB::getDriverName() === 'sqlite' ? '\\\\' : '\\\\\\\\';
235+
$value = str_replace('\\', $escaped, $value);
235236

236237
return DB::connection($connection)->table($table)
237238
->where(function ($query) use ($column, $locale, $value) {

0 commit comments

Comments
 (0)