craftcms / craftcms/cms

GraphQL ignores section filter if section handle does not exist

Open
#7,770 1 comment 0 reactions 1 assignee View on GitHub

@andris-sevcenko is already working on this.

Since Apr 7, 2021.

bug graphql :gear:
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

Description

When running a query filtering for a section handle that does not exist, Craft returns all entries instead of null. This behavior seems to only apply to the section. Filtering for a non-existing slug returns null entries.

Additionally, it also works just fine when we add any other filter to the query.
For example page: entry(section: "i_dont_exist", siteId: "1") returns null.

Steps to reproduce
  1. Create a query for a section that does not exist.
query PageData {
  page: entry(section: "i_dont_exist") {
    id
  }
}
  1. Check that result contains an entry.
{
  "data": {
    "page": {
      "id": "2632"
    }
  }
}
Additional info
  • Craft version: PRO 3.6.11.2
  • PHP version: 7.3.19
  • Database driver & version: MySQL 5.7.33
  • Plugins & versions:
Bulk Edit	2.0.5
Colorit	1.0.9.3
Easy Search	1.0.1
Feed Me	4.3.6
Field Manager	2.2.2
KeyChain	1.0.3
Neo	2.9.5
Reasons	2.2.4
Redactor	2.8.5
SAML Service Provider	2.6.6
Searchit	1.0.8

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.