Fix default value for $type in OC\DB\QueryBuilder\ExpressionBuilder\ExpressionBuilder::literal

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>
This commit is contained in:
Côme Chilliet 2021-10-21 12:41:01 +02:00
parent 10dfdedcbd
commit 18a91f02fa
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A
2 changed files with 4 additions and 4 deletions

View 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));
}

View 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