Run any Drush command results in:

PHP Fatal error: Cannot use Drupal\Component\Utility\Html as Html because the name is already in use in /mnt/wsl/PHYSICALDRIVE0p1/www/unctad/target/web/modules/contrib/file_download/modules/file_download_counter/file_download_counter.module on line 11

Drupal 10.1.5
PHP 8.1.18

Comments

webfaqtory created an issue. See original summary.

webfaqtory’s picture

Priority: Normal » Critical
shelane’s picture

I have the file_download and file_download_counter modules enabled on Drupal 10.1.5 and PHP 8.1.14. I have run several drush commands without any errors reported. What commands are you running that you're encountering this?

webfaqtory’s picture

Just upgraded again from 1.5 to 1.6 and it's worse than just Drush. The site fails to load with a 500 error. In the apache error log there is the same error.

Previously I hadn't even tried the site due to the error from a drush cr

In the .theme file there is use Drupal\Component\Utility\Html;

Also in THEME_preprocess_html there is

$variables['attributes']['class'][] = 'path-' . \Drupal\Component\Utility\Html::cleanCssIdentifier($path_alias);

I suggest you try using Drupal\Component\Utility\Html in your .theme file to get the error

shelane’s picture

The class uses have been moved to a Hook class and should not have a conflict. Look for this in a coming release.

shelane’s picture

Status: Active » Fixed

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.

Status: Fixed » Closed (fixed)

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