Skip to content

don't check if action request for site requests#18613

Closed
i-just wants to merge 1 commit into5.xfrom
bugfix/18605-allSites-site-requests-and-disabled-param
Closed

don't check if action request for site requests#18613
i-just wants to merge 1 commit into5.xfrom
bugfix/18605-allSites-site-requests-and-disabled-param

Conversation

@i-just
Copy link
Contributor

@i-just i-just commented Mar 24, 2026

Description

When figuring out if getting all sites should return the disabled ones, we initially did this:
e4165bd
and then we changed it to this:
a8faf8b

That recent change triggers an infinite recursion for site requests if you’re trying to make one of the special paths site-dependent.

Steps to reproduce:

  • clean 5.9.17 installation
  • add this to the config/general.php:
	->setPasswordPath(function (string $handle) {
        $site = Craft::$app->sites->getSiteByHandle($handle);

        return 'my-set-password';
    })
  • visit any site on the front end, e.g. the homepage

If you have Xdebug enabled, it will error quite quickly with “Xdebug has detected a possible infinite loop”.

The root cause is, as mentioned by the OP.

Solution: don’t include disabled sites for site requests, and don’t attempt to check for action requests in the process.

Related issues

#18605

@i-just i-just requested a review from brandonkelly March 24, 2026 09:03
@brandonkelly
Copy link
Member

That change would have prevented disabled sites from being loaded on CP requests too, unless they were CP action requests.

I think it already has the right logic there – we do want to load disabled sites for all action requests (regardless of whether it’s front-end or CP).

Fixed by just setting $this->_checkedRequestType = true before calling $this->_checkIfActionRequestInternal(), so if one of the config settings ends up causing some recursion, the second call to getIsActionRequest() will immediately return true or false.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants