Bug description
We received two support tickets about this error. Looks like this PR #10392 released with v5.14.0 introduced a bug when trying to access the assets overview in the Control Panel resulting in a Call to undefined method Closure::first() error.
$firstContainerInNav = Nav::build()->pluck('items')->flatten()
->filter(fn (NavItem$navItem) => $navItem->url() === cp_route('assets.index'))
->map(fn (NavItem$navItem) => $navItem->children()?->first())
->first();returns a closure which it tries to call ->first() on resulting in the error.
How to reproduce
Update to >=5.14.0 and access the assets page. Seems to behave differently between local and staging environments and might also be related to having more than one asset container.
Logs
No response
Environment
EnvironmentApplication Name: StatamicLaravel Version: 11.18.1PHP Version: 8.3.7Composer Version: 2.7.6Environment: localDebug Mode: ENABLEDURL: sandbox.testMaintenance Mode: OFFTimezone: UTCLocale: enCacheConfig: NOT CACHEDEvents: NOT CACHEDRoutes: NOT CACHEDViews: CACHEDDriversBroadcasting: logCache: fileDatabase: sqliteLogs: stack / singleMail: logQueue: syncSession: fileStatamicAddons: 0Sites: 2 (Statamic, German)Stache Watcher: EnabledStatic Caching: DisabledVersion: 5.17.0 PRO
Installation
Fresh statamic/statamic site via CLI
Additional details
No response
Bug description
We received two support tickets about this error. Looks like this PR #10392 released with v5.14.0 introduced a bug when trying to access the assets overview in the Control Panel resulting in a
Call to undefined method Closure::first()error.returns a closure which it tries to call
->first()on resulting in the error.How to reproduce
Update to
>=5.14.0and access the assets page. Seems to behave differently between local and staging environments and might also be related to having more than one asset container.Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
No response