- Issue created by @a.novolokov
- π©πͺGermany webflo
I looked at domain 1.x and 2.x, but neither implements the postLoad method in DomainStorage. I think you are running the module on a modified version of the Domain module.
Issue Summary
When using the Domain module (version 2.0.0-beta2) with Drupal 10, a fatal PHP error occurs during cache rebuilds and site loads:
PHP Fatal error: Uncaught Error: Class name must be a valid object or a string in /path/to/web/modules/contrib/domain/domain/src/DomainStorage.php:210
This occurs because the $this->entityClass property can be an object in Drupal 10, but the module code assumes it's always a string.
Additionally, there is a secondary issue with $this->moduleHandler()->getImplementations() calls that are no longer compatible with Drupal 10.
Steps to Reproduce
1. Install Drupal 10.4.x
2. Install Domain module 2.0.0-beta2
3. Run drush cr or load the site in a browser
4. Observe the fatal error
Proposed Solution
The attached patch:
1. Adds type checking for $this->entityClass to handle both string and object cases
2. Replaces getImplementations() calls with invokeAll() for better Drupal 10 compatibility
The patch maintains compatibility with both Drupal 9 and Drupal 10.
Needs review
2.0
Code
I looked at domain 1.x and 2.x, but neither implements the postLoad method in DomainStorage. I think you are running the module on a modified version of the Domain module.