]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix default value for $type in OC\DB\QueryBuilder\ExpressionBuilder\ExpressionBuilder... 29432/head
authorCôme Chilliet <come.chilliet@nextcloud.com>
Thu, 21 Oct 2021 10:41:01 +0000 (12:41 +0200)
committerCôme Chilliet <come.chilliet@nextcloud.com>
Tue, 23 Nov 2021 08:29:02 +0000 (09:29 +0100)
This fixes PHP errors about passing null to PDO::quote second parameter.
We may want to change IExpressionBuilder as well?

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php
lib/public/DB/QueryBuilder/IExpressionBuilder.php

index c35afd0870b09ecdd1c6f9283c7ae6cddace290b..77a4a02128a65f6f77edf767acede5cee9cbd051 100644 (file)
@@ -414,11 +414,11 @@ class ExpressionBuilder implements IExpressionBuilder {
         * Quotes a given input parameter.
         *
         * @param mixed $input The parameter to be quoted.
-        * @param mixed|null $type One of the IQueryBuilder::PARAM_* constants
+        * @param int $type One of the IQueryBuilder::PARAM_* constants
         *
         * @return ILiteral
         */
-       public function literal($input, $type = null): ILiteral {
+       public function literal($input, $type = IQueryBuilder::PARAM_STR): ILiteral {
                return new Literal($this->expressionBuilder->literal($input, $type));
        }
 
index 77701240d5174dd806b9a83e8744295d03ed8e91..4758fd0620854eafca8d47f1aa4a044cfc3b9907 100644 (file)
@@ -418,7 +418,7 @@ interface IExpressionBuilder {
         * Quotes a given input parameter.
         *
         * @param mixed $input The parameter to be quoted.
-        * @param mixed|null $type One of the IQueryBuilder::PARAM_* constants
+        * @param int $type One of the IQueryBuilder::PARAM_* constants
         *
         * @return ILiteral
         * @since 8.2.0
@@ -426,7 +426,7 @@ interface IExpressionBuilder {
         * @psalm-taint-sink sql $input
         * @psalm-taint-sink sql $type
         */
-       public function literal($input, $type = null): ILiteral;
+       public function literal($input, $type = IQueryBuilder::PARAM_STR): ILiteral;
 
        /**
         * Returns a IQueryFunction that casts the column to the given type