Problem/Motivation

There's functions deprecated for removal in core 10

Proposed resolution

remove the usage, make sure no mentions left

Remaining tasks

review/commit

User interface changes

no

API changes

no

Data model changes

no

Release notes snippet

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

andypost created an issue. See original summary.

andypost’s picture

Status: Active » Needs review
FileSize
6.92 KB
longwave’s picture

Status: Needs review » Needs work

Quite a bit more to do here?

core/modules/user/user.module:    @trigger_error('Specifying the notification language using the $langcode parameter is deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Omit the parameter. See https://www.drupal.org/node/3187082', E_USER_DEPRECATED);
core/modules/user/src/Controller/UserAuthenticationController.php:      @trigger_error('Passing the flood service to ' . __METHOD__ . ' is deprecated in drupal:9.1.0 and is replaced by user.flood_control in drupal:10.0.0. See https://www.drupal.org/node/3067148', E_USER_DEPRECATED);
core/modules/user/src/Form/UserLoginForm.php:      @trigger_error('Passing the flood service to ' . __METHOD__ . ' is deprecated in drupal:9.1.0 and is replaced by user.flood_control in drupal:10.0.0. See https://www.drupal.org/node/3067148', E_USER_DEPRECATED);
core/modules/user/src/Form/UserPasswordForm.php:      @trigger_error('Calling ' . __METHOD__ . ' without the $typed_data_manager argument is deprecated in drupal:9.2.0 and will be required in drupal:10.0.0. See https://www.drupal.org/node/3189310', E_USER_DEPRECATED);
core/modules/user/src/Form/UserPasswordForm.php:      @trigger_error('Calling ' . __METHOD__ . ' without the $email_validator argument is deprecated in drupal:9.2.0 and will be required in drupal:10.0.0. See https://www.drupal.org/node/3189310', E_USER_DEPRECATED);
core/modules/user/user.js:            message: 'Returning <span> without data-drupal-selector="password-match-status-text" attribute is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. See https://www.drupal.org/node/3152101'
core/modules/user/user.js:              message: 'The js-password-strength__indicator class is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Replace js-password-strength__indicator with a data-drupal-selector="password-strength-indicator" attribute. See https://www.drupal.org/node/3152101'
core/modules/user/user.js:              message: 'The js-password-strength__text class is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Replace js-password-strength__text with a data-drupal-selector="password-strength-text" attribute. See https://www.drupal.org/node/3152101'
core/modules/user/src/Entity/Role.php:      @trigger_error('Adding non-existent permissions to a role is deprecated in drupal:9.3.0 and triggers a runtime exception before drupal:10.0.0. The incorrect permissions are "' . implode('", "', $invalid_permissions) . '". Permissions should be defined in a permissions.yml file or a permission callback. See https://www.drupal.org/node/3193348', E_USER_DEPRECATED);
paulocs’s picture

Assigned: Unassigned » paulocs

Working on it.

paulocs’s picture

Assigned: paulocs » Unassigned
Status: Needs work » Needs review
FileSize
16.29 KB
16.29 KB
36.17 KB

Removed the deprecation in user.js and removed unnecessary tests.

paulocs’s picture

Please do not consider the interdiff-4-8.txt file in #6.

andypost’s picture

Looks great 👍 but needs another eyes to rtbc

quietone’s picture

Status: Needs review » Needs work

Looks like there is more.

$ grep -r "@trigger" core | grep -v "node_modules" | grep -i core/modules/user
core/modules/user/src/Entity/Role.php:      @trigger_error('Adding non-existent permissions to a role is deprecated in drupal:9.3.0 and triggers a runtime exception before drupal:10.0.0. The incorrect permissions are "' . implode('", "', $invalid_permissions) . '". Permissions should be defined in a permissions.yml file or a permission callback. See https://www.drupal.org/node/3193348', E_USER_DEPRECATED);
core/modules/user/src/Authentication/Provider/Cookie.php:      @trigger_error('The MessengerInterface must be passed to ' . __NAMESPACE__ . '\Cookie::__construct(). It was added in drupal:9.2.0 and will be required before drupal:10.0.0.', E_USER_DEPRECATED);

and the tests

core/modules/user/tests/src/Kernel/Condition/UserRoleConditionTest.php:   * @group legacy
core/modules/user/tests/src/Kernel/UserRoleEntityTest.php:   * @group legacy
paulocs’s picture

Assigned: Unassigned » paulocs

I thought on #4 @andypost means that those deprecations should be replaced in the other issue.
So I'll remove the deprecation in core/modules/user/src/Entity/Role.php here as well per comment #9.

paulocs’s picture

Assigned: paulocs » Unassigned
Status: Needs work » Needs review
FileSize
4.65 KB
41.35 KB

Attaching a new patch and interdiff.
Thanks!

longwave’s picture

  1. +++ b/core/modules/user/src/Authentication/Provider/Cookie.php
    @@ -56,14 +56,10 @@ class Cookie implements AuthenticationProviderInterface, EventSubscriberInterfac
        * @param \Drupal\Core\Messenger\MessengerInterface|null $messenger
    

    No longer can be null.

  2. +++ b/core/modules/user/src/Entity/Role.php
    @@ -201,10 +201,6 @@ public function calculateDependencies() {
    -      @trigger_error('Adding non-existent permissions to a role is deprecated in drupal:9.3.0 and triggers a runtime exception before drupal:10.0.0. The incorrect permissions are "' . implode('", "', $invalid_permissions) . '". Permissions should be defined in a permissions.yml file or a permission callback. See https://www.drupal.org/node/3193348', E_USER_DEPRECATED);
    

    Do we need to trigger an exception here now?

joachim’s picture

Status: Needs review » Needs work

Needs work for #12.

andregp’s picture

Assigned: Unassigned » andregp

I'll work on the points from #12

andregp’s picture

As @longwave pointed Role.php does need to trigger an exception. (https://www.drupal.org/node/3193348)
I added a RuntimeException and restored the test to check for this. I also removed the wrong null parameter indicator in Cookie.php.

andregp’s picture

Status: Needs work » Needs review

I forgot to change the status.

longwave’s picture

Status: Needs review » Needs work

Thanks for working on this.

  1. +++ b/core/modules/user/src/Entity/Role.php
    @@ -203,7 +203,7 @@ public function calculateDependencies() {
    +      throw new \RuntimeException('Adding non-existent permissions to a role is not allowed. The incorrect permissions are "' . implode('", "', $invalid_permissions) . '". Permissions should be defined in a permissions.yml file or a permission callback. See https://www.drupal.org/node/3193348');
    

    Not sure we need to link the change record here, nor even specify how permissions are defined - we don't usually do that in exception messages. Listing the error and the undefined permissions is enough, I think.

  2. +++ b/core/modules/user/tests/src/Kernel/UserRoleEntityTest.php
    @@ -35,12 +35,14 @@ public function testGrantingNonExistentPermission() {
    +    $this->expectException(\RuntimeException::class);
    

    The @group legacy comment needs removing from this test method, as we are converting it to a permanent test of the exception.

andregp’s picture

Assigned: andregp » Unassigned
Status: Needs work » Needs review
FileSize
2.77 KB
41.89 KB

Thanks @longwave for the review.

Here is the new patch.

Status: Needs review » Needs work

The last submitted patch, 18: 3261248-18.patch, failed testing. View results

longwave’s picture

Status: Needs work » Needs review

Unrelated fail, sending for retest.

longwave’s picture

Status: Needs review » Reviewed & tested by the community
+++ b/core/modules/user/src/Entity/Role.php
@@ -203,7 +203,7 @@ public function calculateDependencies() {
     if (!empty($invalid_permissions) && !$this->get('skip_missing_permission_deprecation')) {

This setting has the wrong name now as the deprecation is replaced by an exception, but I don't think we should change it here - this will be removed in #2953111: Only migrate role permissions that exist on the destination

This all looks good to me now, so RTBC.

  • catch committed dcc51c8 on 10.0.x
    Issue #3261248 by paulocs, andregp, andypost, longwave, quietone: Remove...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed dcc51c8 and pushed to 10.0.x. Thanks!

Status: Fixed » Closed (fixed)

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