Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUGFIX: SiteDetectionMiddleware should not crash without doctrine migrations #4715

Merged

Conversation

mhsdesign
Copy link
Member

@mhsdesign mhsdesign commented Nov 8, 2023

The SiteDetectionMiddleware tries to match the current requested host to a site entity. For that our doctrine repositories are required. But in the case doctrine is not setup (migrated or no database exists) this middleware should not throw!

Especially non neos routes must still work as the site detection stuff is only mandatory for neos escr things.

Additional fix for #4446

Upgrade instructions

Review instructions

Checklist

  • Code follows the PSR-2 coding style
  • Tests have been created, run and adjusted as needed
  • The PR is created against the lowest maintained branch
  • Reviewer - PR Title is brief but complete and starts with FEATURE|TASK|BUGFIX
  • Reviewer - The first section explains the change briefly for change-logs
  • Reviewer - Breaking Changes are marked with !!! and have upgrade-instructions

@mhsdesign mhsdesign force-pushed the bugfix/siteDetectionMiddlewareShouldNotCrash branch from a4990f3 to 4f605ee Compare November 8, 2023 15:44
@mhsdesign mhsdesign force-pushed the bugfix/siteDetectionMiddlewareShouldNotCrash branch from 4f605ee to 936860d Compare November 8, 2023 21:56
@mhsdesign mhsdesign requested a review from kitsunet November 8, 2023 21:57
@kitsunet
Copy link
Member

kitsunet commented Nov 9, 2023

This seems so overly complicated somehow, doesn#t it boil down to:

try { <stuff to find site> } catch {site = null} 
if ($site instanceof Site) {
    $siteDetectionResult = SiteDetectionResult::create($site->getNodeName(), $site->getConfiguration()->contentRepositoryId);
    $request = $siteDetectionResult->storeInRequest($request)
}

return $handler->handle($request);

@kitsunet
Copy link
Member

kitsunet commented Nov 9, 2023

I would also catch this silently here I guess? but that's srely debatable, I don't think this is the right place to explode about it though.

@mhsdesign mhsdesign merged commit 1801fbb into neos:9.0 Nov 12, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants