- Affected version
- 2.2.5
Suppose a new multi-column sort order is added by extending in
When set as an explicit forum filter, this results in the following code;
The resulting SQL contains;
When set as the forum default without an explicit filter;
The resulting SQL contains;
The problem is
\XF\Repository with;
PHP:
public function getDefaultThreadListSortOptions($forAdminConfig): array
{
$options = parent::getDefaultThreadListSortOptions($forAdminConfig);
$options['MyNewColumnAlias'] = [
['MyNewColumn'],
['last_post_date'],
];
return $options;
}
When set as an explicit forum filter, this results in the following code;
PHP:
$finder->setOrder([
['MyNewColumn'],
['last_post_date'],
], 'desc');
order by MyNewColumn desc, last_post_date descWhen set as the forum default without an explicit filter;
PHP:
$finder->setDefaultOrder([
['MyNewColumn'],
['last_post_date'],
], 'desc');
order by MyNewColumn asc, last_post_date asc.The problem is
setDefaultOrder() calls standardizeOrderingValue() while order() does not, and standardizeOrderingValue() is inconsistent with order() in how a default direction applied to the sorting order.