Drupal Version

10.2.6

Domain module version

2.0.0-beta1

Expected Behavior

[What did you try to do? What URL did you use to do it?]
There are three sub-domains, each domain as a separate frontpage view, the Access is set to Domain. Try to put block contents on these frontage views.

Actual Behavior

[What actually happened?]
successfully put two block contents on the frontpages of domian A and B with restricts Domain and pages, while the third block content on the frontpage of domain C does not show up except for the Administrator, and after enabling debugging, an exception is thrown:

Error: Call to a member function id() on null in Drupal\domain\Access\DomainRouteCheck->access() (line 74 of modules/contrib/domain/domain/src/Access/DomainRouteCheck.php).
call_user_func_array() (Line: 160)
Drupal\Core\Access\AccessManager->performCheck() (Line: 136)
Drupal\Core\Access\AccessManager->check() (Line: 113)
Drupal\Core\Access\AccessManager->checkRequest() (Line: 107)
Drupal\Core\Routing\AccessAwareRouter->checkAccess() (Line: 92)
Drupal\Core\Routing\AccessAwareRouter->matchRequest() (Line: 144)
Drupal\Core\Routing\AccessAwareRouter->match() (Line: 138)
Drupal\user\Plugin\LanguageNegotiation\LanguageNegotiationUserAdmin->isAdminPath() (Line: 104)
Drupal\user\Plugin\LanguageNegotiation\LanguageNegotiationUserAdmin->getLangcode() (Line: 197)
Drupal\language\LanguageNegotiator->negotiateLanguage() (Line: 137)
Drupal\language\LanguageNegotiator->initializeType() (Line: 218)
Drupal\language\ConfigurableLanguageManager->getCurrentLanguage() (Line: 237)
Drupal\domain_config\DomainConfigOverrider->initiateContext() (Line: 120)
Drupal\domain_config\DomainConfigOverrider->loadOverrides() (Line: 209)
Drupal\Core\Config\ConfigFactory->loadOverrides() (Line: 169)
Drupal\Core\Config\ConfigFactory->doLoadMultiple() (Line: 68)
Drupal\domain_config_ui\Config\ConfigFactory->doLoadMultiple() (Line: 104)
Drupal\Core\Config\ConfigFactory->doGet() (Line: 109)
Drupal\domain_config_ui\Config\ConfigFactory->doGet() (Line: 89)
Drupal\Core\Config\ConfigFactory->get() (Line: 90)
Drupal\system\TimeZoneResolver->getTimeZone() (Line: 53)
Drupal\system\TimeZoneResolver->setDefaultTimeZone()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 65)
Drupal\Core\Session\AccountProxy->setAccount() (Line: 79)
Drupal\Core\EventSubscriber\AuthenticationSubscriber->onKernelRequestAuthenticate()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 157)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
Drupal\Core\DrupalKernel->handle() (Line: 19)

Steps to reproduce

[A bullet list of steps to reproduce the error. Note if the error always happens or sometimes happens.]
1. Create three domains
2. Create three frontpages for these domains with Access: Domian, and set these as the frontpages of these domains through System-->Basic site settings
4. Create block content and put to each frontpage through block layout with restricts Domain and pages
All these block contents are the same and the the situation remains the same even remove the restricts.

Issue fork domain-3456056

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

hongqing created an issue. See original summary.

abhishek_gupta1’s picture

Assigned: Unassigned » abhishek_gupta1

abhishek_gupta1’s picture

Assigned: abhishek_gupta1 » Unassigned
Status: Active » Needs review

@hongqing, I have fixed the issue and created MR , Please review it once.

agentrickard’s picture

Status: Needs review » Needs work

I'd like to see an explicit NULL check rather than the older if ($domain) style.

is_null or instanceof would both be fine here.

davps’s picture

Version: 2.0.0-beta1 » 2.0.x-dev

I can't reproduce the problem on a clean install of Drupal 10 and on the dev branch.
Based on the suggested changes, the changes look good, but I'd like to understand how to reproduce the problem. More details needed.

agentrickard’s picture

It may just be an edge case. I don't mind the extra check for instanceOf in that case.

agentrickard’s picture

Status: Needs work » Needs review

I have pushed the minor change to the branch.

agentrickard’s picture

Status: Needs review » Fixed

Merged.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

hongqing’s picture

Thank you for quick response. Now I found it may be related to users. This occurs when I login with a role I created, there is no error with admin and authenticated roles.

hongqing’s picture

This particularly happens on view with Access permission on domains, never happens on content.