cms
cms copied to clipboard
[5.x]: issue with Dropdown and `:empty:`
What happened?
Description
Query with :empty: don't work as expected with CraftCMS 5.
Steps to reproduce
- Create a dropdown with following values:
- Add the field to a section, ex: users
- Create 2 entries
- Set all to
admin - run this query:
{% set users = craft
.entries()
.section('users')
.userRole(['not', ':empty:'])
.all()
%}
{% dd users | map( e => {
title: e.title,
userRole:e.userRole.value
}) %}
This will find all 2 entries
set on to none and re run the query, the result is still 2
update the query to .userRole(['not', '']), now the result is only one.
Expected behavior
:empty: should also work if the value is an empty string
Actual behavior
:empty: and "" don't return the same result
Craft CMS version
5.8.21
PHP version
8.2.28
Operating system and version
No response
Database type and version
MySQL 8.0.40
Image driver and version
No response
Installed plugins and versions
No response
Thanks for reporting that! Fixed for the next release.