- Issue created by @ankondrat4
- πΊπΈUnited States freelock Seattle
Hi,
Does this change require Drupal 10 only? I see you've removed the 8 and 9 compatibility from the info file...
Cheers,
John - πΊπ¦Ukraine ankondrat4 Lutsk
Hi @freelock
Yes, this version only for Drupal 10, because we have DomainCookie that extends from class Cookie. Class Cookie in D10 has three arguments, but in D8-9 had only 2 arguments.
D10
https://api.drupal.org/api/drupal/core!modules!user!src!Authentication!P.../** * Constructs a new cookie authentication provider. * * @param \Drupal\Core\Session\SessionConfigurationInterface $session_configuration * The session configuration. * @param \Drupal\Core\Database\Connection $connection * The database connection. * @param \Drupal\Core\Messenger\MessengerInterface $messenger * The messenger. */ public function __construct(SessionConfigurationInterface $session_configuration, Connection $connection, MessengerInterface $messenger) { $this->sessionConfiguration = $session_configuration; $this->connection = $connection; $this->messenger = $messenger; }
D8-D9
https://api.drupal.org/api/drupal/core%21modules%21user%21src%21Authenti.../** * Constructs a new cookie authentication provider. * * @param \Drupal\Core\Session\SessionConfigurationInterface $session_configuration * The session configuration. * @param \Drupal\Core\Database\Connection $connection * The database connection. */ public function __construct(SessionConfigurationInterface $session_configuration, Connection $connection) { $this->sessionConfiguration = $session_configuration; $this->connection = $connection; }
- πͺπͺEstonia drugan
Doesn't that violate the dependency injection requirement?
The
DomainCookie::getUserFromSession()
method is called on each page view, so it may become a performance issue.Anyway, if we go the way suggested, then the
DomainCookie::__construct()
method can be omitted at all. - Issue was unassigned.
- πΊπ¦Ukraine ankondrat4 Lutsk
Hello.
Compatible with Drupal 10 was applied.
When we tried to use DI of service @domain.negotiator, we got Fatal error as described in description of task. Maybe someone has solution, you are welcome to change this)Please, review.
- Status changed to Needs review
11 months ago 10:45am 22 January 2024 - Status changed to Needs work
11 months ago 2:00pm 22 January 2024 - πͺπͺEstonia drugan
@ankondrat4
I think there should be some other way to fix the Circular reference fatal.
Also, because of the issue name we need to fix all Drupal 10 compatibility errors, not just that fatal:
drugan@multidomains-web:/var/www/html$ vendor/bin/phpstan analyze --level=0 web/modules/contrib/domain_role Note: Using configuration file /var/www/html/phpstan.neon. 7/7 [ββββββββββββββββββββββββββββ] 100% ------ ------------------------------------------------------------------------------ Line domain_role.module ------ ------------------------------------------------------------------------------ 104 Construct empty() is not allowed. Use more strict comparison. 114 Call to function in_array() requires parameter #3 to be set. 115 Implicit array creation is not allowed - variable $newroles might not exist. 118 Implicit array creation is not allowed - variable $newroles might not exist. 133 Construct empty() is not allowed. Use more strict comparison. ------ ------------------------------------------------------------------------------ ------ ------------------------------------------------------------------------- Line src/Authentication/Provider/DomainCookie.php ------ ------------------------------------------------------------------------- 37 Only booleans are allowed in an if condition, mixed given. 45 Construct empty() is not allowed. Use more strict comparison. 55 Call to deprecated function user_roles(): in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\user\Entity\Role::loadMultiple() and, if necessary, an inline implementation instead. 58 Call to function in_array() requires parameter #3 to be set. 58 Call to function in_array() requires parameter #3 to be set. 63 Call to function in_array() requires parameter #3 to be set. ------ ------------------------------------------------------------------------- ------ ------------------------------------------------------------------------------ Line src/Entity/DomainUser.php ------ ------------------------------------------------------------------------------ 38 Call to deprecated function user_role_names(): in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\user\Entity\Role::loadMultiple() and, if necessary, an inline implementation instead. 52 Call to function in_array() requires parameter #3 to be set. 52 Call to function in_array() requires parameter #3 to be set. 74 Call to function in_array() requires parameter #3 to be set. 80 Call to function in_array() requires parameter #3 to be set. 86 Method Drupal\domain_role\Entity\DomainUser::addRole() should return $this(Drupal\domain_role\Entity\DomainUser) but return statement is missing. 101 Call to function in_array() requires parameter #3 to be set. 103 Method Drupal\domain_role\Entity\DomainUser::removeRole() should return $this(Drupal\domain_role\Entity\DomainUser) but return statement is missing. 120 Call to function in_array() requires parameter #3 to be set. 123 Call to function in_array() requires parameter #3 to be set. 129 Call to function in_array() requires parameter #3 to be set. 135 Variable property access on $this(Drupal\domain_role\Entity\DomainUser). 136 Variable property access on $this(Drupal\domain_role\Entity\DomainUser). ------ ------------------------------------------------------------------------------ ------ ---------------------------------------------------------------------------------------------------- Line tests/src/Functional/LoadTest.php ------ ---------------------------------------------------------------------------------------------------- 32 Return type mixed of method Drupal\Tests\domain_role\Functional\LoadTest::setUp() is not covariant with return type void of method Drupal\Tests\BrowserTestBase::setUp(). ------ ---------------------------------------------------------------------------------------------------- -- ------------------------------------------------------------------------------------------------------ Error -- ------------------------------------------------------------------------------------------------------ Ignored error pattern #^Dynamic call to static method PHPUnit\\Framework\\Assert# was not matched in reported errors. -- ------------------------------------------------------------------------------------------------------ [ERROR] Found 26 errors
- πΊπΈUnited States freelock Seattle
Creating a new major version, since Drupal 9 is no longer supported with this change.
-
freelock β
committed 79e617f9 on 3.0.x authored by
ankondrat4 β
Issue #3415984: Drupal 10 compatibility
-
freelock β
committed 79e617f9 on 3.0.x authored by
ankondrat4 β
- πΊπΈUnited States freelock Seattle
Merging in for further review and testing, thanks for your work on this!
- Merge request !3Properly inject dependencies in the DomainCookie constructor β (Open) created by drugan
- Status changed to Needs review
11 months ago 7:09am 23 January 2024 - πͺπͺEstonia drugan
The
MR !3
properly injects dependencies without causing the Circular reference fatal. - Status changed to RTBC
11 months ago 7:37am 29 January 2024