diff --git a/typo3/sysext/core/Classes/Database/Query/Expression/ExpressionBuilder.php b/typo3/sysext/core/Classes/Database/Query/Expression/ExpressionBuilder.php
index 4d58337f4607ff1d6e20b646d02536ec9e482025..b2c177d5e6d2c6a25c607a07ad4ce05fc50fd4b8 100644
--- a/typo3/sysext/core/Classes/Database/Query/Expression/ExpressionBuilder.php
+++ b/typo3/sysext/core/Classes/Database/Query/Expression/ExpressionBuilder.php
@@ -347,18 +347,32 @@ class ExpressionBuilder
                         1476029421
                     );
                 }
-
-                return $this->comparison(
-                    implode('||', [
-                        $this->literal(','),
-                        $this->connection->quoteIdentifier($fieldName),
-                        $this->literal(','),
-                    ]),
-                    'LIKE',
-                    $this->literal(
-                        '%,' . $this->unquoteLiteral($value) . ',%'
+                $comparison = sprintf(
+                    'instr(%s, %s)',
+                    implode(
+                        '||',
+                        [
+                            $this->literal(','),
+                            $this->connection->quoteIdentifier($fieldName),
+                            $this->literal(','),
+                        ]
+                    ),
+                    $isColumn ?
+                        implode(
+                            '||',
+                            [
+                                $this->literal(','),
+                                // do not explicitly quote value as it is expected to be
+                                // quoted by the caller
+                                'cast(' . $value . ' as text)',
+                                $this->literal(','),
+                            ]
+                        )
+                        : $this->literal(
+                        ',' . $this->unquoteLiteral($value) . ','
                     )
                 );
+                return $comparison;
                 break;
             default:
                 return sprintf(
diff --git a/typo3/sysext/core/Tests/Unit/Database/Query/Expression/ExpressionBuilderTest.php b/typo3/sysext/core/Tests/Unit/Database/Query/Expression/ExpressionBuilderTest.php
index fddd900535ae774c5312f5d67ccebb9188d58303..10ff586dad25523a2f82d70ca1f016006e7f4c4e 100644
--- a/typo3/sysext/core/Tests/Unit/Database/Query/Expression/ExpressionBuilderTest.php
+++ b/typo3/sysext/core/Tests/Unit/Database/Query/Expression/ExpressionBuilderTest.php
@@ -321,7 +321,7 @@ class ExpressionBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
         $databasePlatform->getStringLiteralQuoteCharacter()->willReturn("'");
 
         $this->connectionProphet->quote(',', Argument::cetera())->shouldBeCalled()->willReturn("','");
-        $this->connectionProphet->quote('%,1,%', Argument::cetera())->shouldBeCalled()->willReturn("'%,1,%'");
+        $this->connectionProphet->quote(',1,', Argument::cetera())->shouldBeCalled()->willReturn("'%,1,%'");
         $this->connectionProphet->quoteIdentifier(Argument::cetera())->will(function ($args) {
             return '"' . $args[0] . '"';
         });
@@ -330,7 +330,7 @@ class ExpressionBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
 
         $result = $this->subject->inSet('aField', "'1'");
 
-        $this->assertSame('\',\'||"aField"||\',\' LIKE \'%,1,%\'', $result);
+        $this->assertSame('instr(\',\'||"aField"||\',\', \'%,1,%\')', $result);
     }
 
     /**
@@ -343,8 +343,8 @@ class ExpressionBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
         $databasePlatform->getStringLiteralQuoteCharacter()->willReturn("'");
 
         $this->connectionProphet->quote(',', Argument::cetera())->shouldBeCalled()->willReturn("','");
-        $this->connectionProphet->quote('%,\'Some\'Value,%', Argument::cetera())->shouldBeCalled()
-            ->willReturn("'%,''Some''Value,%'");
+        $this->connectionProphet->quote(',\'Some\'Value,', Argument::cetera())->shouldBeCalled()
+            ->willReturn("',''Some''Value,'");
         $this->connectionProphet->quoteIdentifier(Argument::cetera())->will(function ($args) {
             return '"' . $args[0] . '"';
         });
@@ -353,7 +353,7 @@ class ExpressionBuilderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCa
 
         $result = $this->subject->inSet('aField', "'''Some''Value'");
 
-        $this->assertSame('\',\'||"aField"||\',\' LIKE \'%,\'\'Some\'\'Value,%\'', $result);
+        $this->assertSame('instr(\',\'||"aField"||\',\', \',\'\'Some\'\'Value,\')', $result);
     }
 
     /**