Problem/Motivation

The Webform module uses deprecated APIs that cause warnings when running Upgrade Status or preparing for Drupal 11+ compatibility.

Deprecation warnings

SanitizePluginInterface (Drush)
Class Drupal\webform\Commands\WebformSanitizeSubmissionsCommands implements deprecated interface 
Drush\Drupal\Commands\sql\SanitizePluginInterface: use \Drush\Commands\sql\sanitize\SanitizePluginInterface instead.
Affected file
  • src/Commands/WebformSanitizeSubmissionsCommands.php
ModuleHandlerInterface::loadInclude()

File modules/contrib/webform/webform.tokens.inc could not be loaded from Drupal\Core\Extension\ModuleHandlerInterface::loadInclude

Affected files
  • src/Hook/WebformHooks.php
  • src/Plugin/Block/WebformSubmissionLimitBlock.php

Steps to reproduce

  1. Install and enable the Webform module
  2. Install and enable the Upgrade Status module
  3. Navigate to /admin/reports/upgrade-status
  4. Select the Webform module and click "Scan selected"
  5. Review the deprecation warnings

Proposed resolution

Update Drush SanitizePluginInterface namespace:

  • Change use Drush\Drupal\Commands\sql\SanitizePluginInterface; to use Drush\Commands\sql\sanitize\SanitizePluginInterface;

Fix loadInclude() calls:

  • The second parameter should be the file extension 'inc', and the third parameter should be the filename without extension 'webform.tokens'
  • Change loadInclude('webform', 'tokens.inc') to loadInclude('webform', 'inc', 'webform.tokens')

Remaining tasks

I am attaching a patch that addresses both issues and provides a workaround until this is fixed by the maintainers.

CommentFileSizeAuthor
webform-deprecated.patch1.57 KBtitacvetkovic

Comments

titacvetkovic created an issue. See original summary.

liam morland’s picture

Version: 6.3.0-beta6 » 6.3.x-dev
Status: Active » Needs work

There is already a fix to ::loadInclude() in 6.3.x. For the other one, is there a change record for this? We need to make sure this doesn't cause a backward compatibility issue. Please put your changes into an issue fork and merge request.

titacvetkovic’s picture

Hi @liam

I see that the patch is now incorporated into 6.3.0-beta6. All three changes are now present in the files:
- WebformSanitizeSubmissionsCommands.php uses Drush\Commands\sql\sanitize\SanitizePluginInterface
- The loadInclude() calls use the updated signature

I believe the issue can be closed.

Best,
Tita

liam morland’s picture

Status: Needs work » Closed (duplicate)

Thanks. These issues appear to have been addressed in #3565161: Fix issues raised by phpstan and #3477942: Fix phpstan errors. The last change was rolled-back in #3537579: Drush\Commands\sql\sanitize\SanitizePluginInterface not found.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.