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
Bug description
When using the
Entryfacade to build aquery(), awhere('collection', …)orwhereIn('collection', …)inside a nestedwhere()/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
Logs
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response