When parsing Parameters to create a DataTableQuery, the values (like 'searchable' or 'orderable') are cast to a boolean with code like:
(bool) $column['orderable']
But the parameter value is the literal 'true' or 'false' and when cast, it returns always true because a non-empty string to a bool value, returns always true.
A bug fix is to test the literal value with code like:
True, thank you for the finding. I have updated the UnitTests so they find this issue now, then fixed the bug and released new version 2.3.2. Please upgrade.
When parsing Parameters to create a DataTableQuery, the values (like
'searchable'
or'orderable'
) are cast to a boolean with code like:(bool) $column['orderable']
But the parameter value is the literal
'true'
or'false'
and when cast, it returns alwaystrue
because a non-empty string to a bool value, returns alwaystrue
.A bug fix is to test the literal value with code like:
'true' === $column['orderable']
or
filter_var($column['orderable'], FILTER_VALIDATE_BOOLEAN)
or modify the validation with:
->setAllowedTypes('orderable', 'boolean')
See: PHP Documentation
Tested with Symfony v3.4.24 and PHP v7.2.14.