diff --git a/lib/private/DB/AdapterOCI8.php b/lib/private/DB/AdapterOCI8.php index d67308c538b4..011180f68115 100644 --- a/lib/private/DB/AdapterOCI8.php +++ b/lib/private/DB/AdapterOCI8.php @@ -41,7 +41,7 @@ public function lastInsertId($table) { public function fixupStatement($statement) { $statement = \preg_replace('( LIKE \?)', '$0 ESCAPE \'\\\'', $statement); - $statement = \preg_replace('/`(\w+)` ILIKE \?/', 'REGEXP_LIKE(`$1`, \'^\' || REPLACE(?, \'%\', \'.*\') || \'$\', \'i\')', $statement); + $statement = \preg_replace('/`(\w+)` ILIKE \?/', "REGEXP_LIKE(`$1`, '^' || REPLACE(REGEXP_REPLACE(REPLACE(?, '[', '\\['), '(\\]|[\\*+?|^$.[(){}])', '\\\\\\1'), '%', '.*') || '$', 'i')", $statement); $statement = \str_replace('`', '"', $statement); $statement = \str_ireplace('NOW()', 'CURRENT_TIMESTAMP', $statement); $statement = \str_ireplace('UNIX_TIMESTAMP()', self::UNIX_TIMESTAMP_REPLACEMENT, $statement); diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php index 8fbb4d6937cd..aa906b0f1577 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/OCIExpressionBuilder.php @@ -158,7 +158,7 @@ public function castColumn($column, $type) { public function iLike($x, $y, $type = null) { $x = $this->helper->quoteColumnName($x); $y = $this->helper->quoteColumnName($y); - return new QueryFunction('REGEXP_LIKE('.$x.', \'^\' || REPLACE('.$y.', \'%\', \'.*\') || \'$\', \'i\')'); + return new QueryFunction("REGEXP_LIKE($x, '^' || REPLACE(REGEXP_REPLACE(REPLACE($y, '[', '\\['), '(\\]|[\\*+?|^$.[(){}])', '\\\\\\1'), '%', '.*') || '$', 'i')"); } /**