[5.x]: Issue querying against checkbox fields
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.6k
- Forks
- 705
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 134
Description
What happened?
Description
When trying to narrow a query via a checkbox field alone. Combined with other fields it seems to be okay.
{% extends '_/layouts/default' %}
{% block content %}
{% set test = craft.entries().section('solutions').gender('male').all() %}
{% dd test %}
{% endblock %}
Steps to reproduce
- Create a section
- Add a checkbox field to it
- Create a few test entries with various values on the checkboxes
- Create simple template and try to query the section with a value passed to the checkbox field in the query
- It should throw an exception
Expected behavior
It should execute the query absolutely fine
Actual behavior
Throws am exception
Craft CMS version
5.8.20
PHP version
8.3.23
Operating system and version
Linux 6.17.8-orbstack-00308-g8f9c941121b1
Database type and version
MySQL 8.0.40
Image driver and version
Imagick 3.8.0 (ImageMagick 6.9.11-60)
Installed plugins and versions
"craftcms/feed-me": "6.11.0",
"craftcms/postmark": "^3.1",
"nystudio107/craft-retour": "5.0.12",
"nystudio107/craft-seomatic": "5.1.19",
"nystudio107/craft-vite": "5.0.1",
"putyourlightson/craft-blitz": "5.12.5",
"putyourlightson/craft-sprig": "3.7.1",
"vaersaagod/dospaces": "3.2.1",
"verbb/hyper": "2.2.10",
"viget/craft-classnames": "3.0.0",
"vlucas/phpdotenv": "^5.6.0"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the checkbox-only query from the issue in a Craft CMS 5.8.20 section with several checkbox values, using the provided Twig template. Capture the exception and compare it with a query combining another field. Done means the checkbox-only query executes successfully and returns the entries matching the selected value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, php
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100