File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ Yii Framework 2 Change Log
14
14
- Enh #19689 : Remove empty elements from the ` class ` array in ` yii\helpers\BaseHtml::renderTagAttributes() ` to prevent unwanted spaces (MoritzLost)
15
15
- Chg #19696 : Change visibility of ` yii\web\View::isPageEnded ` to ` protected ` (lubosdz, samdark)
16
16
- Bug #19712 : Cast shell_exec() output to string for jsCompressor (impayru)
17
+ - Bug #19734 : PHP 8.1 compatibility fix for ` $query->orderBy(null) ` (uaoleg)
17
18
- Bug #19731 : Fix ` yii\data\Sort ` to generate proper link when multisort is on and attribute has a default sort order set (bizley)
18
19
- Bug #19735 : Fix ` yii\validators\NumberValidator ` to use programmable message for the value validation (bizley)
19
20
Original file line number Diff line number Diff line change @@ -305,7 +305,7 @@ protected function isEmpty($value)
305
305
306
306
/**
307
307
* Sets the ORDER BY part of the query.
308
- * @param string|array|ExpressionInterface $columns the columns (and the directions) to be ordered by.
308
+ * @param string|array|ExpressionInterface|null $columns the columns (and the directions) to be ordered by.
309
309
* Columns can be specified in either a string (e.g. `"id ASC, name DESC"`) or an array
310
310
* (e.g. `['id' => SORT_ASC, 'name' => SORT_DESC]`).
311
311
*
@@ -358,12 +358,14 @@ public function addOrderBy($columns)
358
358
/**
359
359
* Normalizes format of ORDER BY data.
360
360
*
361
- * @param array|string|ExpressionInterface $columns the columns value to normalize. See [[orderBy]] and [[addOrderBy]].
361
+ * @param array|string|ExpressionInterface|null $columns the columns value to normalize. See [[orderBy]] and [[addOrderBy]].
362
362
* @return array
363
363
*/
364
364
protected function normalizeOrderBy ($ columns )
365
365
{
366
- if ($ columns instanceof ExpressionInterface) {
366
+ if (empty ($ columns )) {
367
+ return [];
368
+ } elseif ($ columns instanceof ExpressionInterface) {
367
369
return [$ columns ];
368
370
} elseif (is_array ($ columns )) {
369
371
return $ columns ;
You can’t perform that action at this time.
0 commit comments