Skip to content

Password-protected site throws exception on root url #15085

Description

@daun

Bug description

When password protection is enabled and all sites start with a prefix (e.g., /en, /fr), accessing the root (/) leads to an exception. The controllers tries to get the current site by URL and doesn't find it, but then tries to get the language without checking if it found an actual site.

Call to a member function lang() on null

How to reproduce

  • Create multiple sites and enable multi-site mode
  • Prefix all of the sites with a language abbreviation
  • Enable password protection
  • Access the root / without language prefix

Logs

Environment

Environment
Laravel Version: 13.22.0
PHP Version: 8.4.20
Composer Version: 2.8.3
Environment: local
Debug Mode: ENABLED
Maintenance Mode: OFF
Timezone: Europe/Vienna
Locale: de

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

Drivers
Broadcasting: log
Cache: file
Database: sqlite
Logs: stack / daily
Mail: log
Queue: database
Session: file

Storage
public/storage: NOT LINKED

Statamic
License Key: Not set
Sites: 2 (DE, EN)
Stache Watcher: Enabled
Static Caching: Disabled
Version: 6.26.0 PRO

Statamic Eloquent Driver
Addon Settings: eloquent
Asset Containers: file
Assets: eloquent
Blueprints: file
Collection Trees: eloquent
Collections: file
Entries: eloquent
Fieldsets: file
Form Submissions: eloquent
Forms: file
Global Sets: file
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: file
Revisions: eloquent
Sites: file
Taxonomies: file
Terms: eloquent
Tokens: eloquent

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions