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 functionlang() 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

EnvironmentLaravel Version: 13.22.0PHP Version: 8.4.20Composer Version: 2.8.3Environment: localDebug Mode: ENABLEDMaintenance Mode: OFFTimezone: Europe/ViennaLocale: deCacheConfig: NOT CACHEDEvents: NOT CACHEDRoutes: NOT CACHEDViews: CACHEDDriversBroadcasting: logCache: fileDatabase: sqliteLogs: stack / dailyMail: logQueue: databaseSession: fileStoragepublic/storage: NOT LINKEDStatamicLicense Key: Not setSites: 2 (DE, EN)Stache Watcher: EnabledStatic Caching: DisabledVersion: 6.26.0 PROStatamic Eloquent DriverAddon Settings: eloquentAsset Containers: fileAssets: eloquentBlueprints: fileCollection Trees: eloquentCollections: fileEntries: eloquentFieldsets: fileForm Submissions: eloquentForms: fileGlobal Sets: fileGlobal Variables: eloquentNavigation Trees: eloquentNavigations: fileRevisions: eloquentSites: fileTaxonomies: fileTerms: eloquentTokens: eloquent

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions