Merge pull request #19949 from uaoleg/patch-2

PHP 8.1 trim(): Passing null to parameter #1 ($string) of type string is deprecated
This commit is contained in:
Bizley
2023-09-20 11:31:00 +02:00
committed by GitHub
2 changed files with 3 additions and 2 deletions

View File

@ -7,6 +7,7 @@ Yii Framework 2 Change Log
- Bug #19925: Improved PHP version check when handling MIME types (schmunk42)
- Bug #19940: File Log writer without newline (terabytesoftw)
- Bug #19951: Removed unneeded MIME file tests (schmunk42)
- Bug #19950: Fix `Query::groupBy(null)` causes error for PHP 8.1: `trim(): Passing null to parameter #1 ($string) of type string is deprecated`
2.0.49 August 29, 2023

View File

@ -1049,7 +1049,7 @@ PATTERN;
/**
* Sets the GROUP BY part of the query.
* @param string|array|ExpressionInterface $columns the columns to be grouped by.
* @param string|array|ExpressionInterface|null $columns the columns to be grouped by.
* Columns can be specified in either a string (e.g. "id, name") or an array (e.g. ['id', 'name']).
* The method will automatically quote the column names unless a column contains some parenthesis
* (which means the column contains a DB expression).
@ -1067,7 +1067,7 @@ PATTERN;
{
if ($columns instanceof ExpressionInterface) {
$columns = [$columns];
} elseif (!is_array($columns)) {
} elseif (!is_array($columns) && !is_null($columns)) {
$columns = preg_split('/\s*,\s*/', trim($columns), -1, PREG_SPLIT_NO_EMPTY);
}
$this->groupBy = $columns;