Skip to content

Stache: ->where('collection', …) inside a nested where() closure is silently ignored #15560

Description

@obelloc

Bug description

When using the Entry facade to build a query(), a where('collection', …) or whereIn('collection', …) inside a nested where() / orWhere() closure has no effect. No exception is thrown. The constraint is silently dropped and the query returns entries from other collections.

How to reproduce

Entry::query()
    ->where(fn ($q) => $q->where('collection', 'blog')) // ignored
    ->count();

Logs

Environment

Environment
Application Name: Statamic
Laravel Version: 12.64.0
PHP Version: 8.4.23
Composer Version: 2.10.3
Environment: local
Debug Mode: ENABLED
URL: localhost
Maintenance Mode: OFF
Timezone: UTC
Locale: en

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: file
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file

Storage
public/storage: NOT LINKED

Statamic
Addons: 2
Sites: 8 (English, Deutsch, Español, and 5 more)
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.74.3 PRO

Statamic Addons
jacksleight/statamic-bard-mutator: 3.0.5
jacksleight/statamic-bard-texstyle: 3.5.6

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions