Error: Class "Drupal\Component\Utility\DeprecationHelper" not found

Created on 21 May 2024, 11 months ago

Problem/Motivation

Drupal 9.5.11:
The website encountered an unexpected error. Please try again later.
Error: Class "Drupal\Component\Utility\DeprecationHelper" not found in Drupal\taxonomy_entity_index\Plugin\views\argument\TaxonomyEntityIndexDepth->__construct() (line 37 of modules/contrib/taxonomy_entity_index/src/Plugin/views/argument/TaxonomyEntityIndexDepth.php).

Steps to reproduce

Click Reindex

https://www.drupal.org/node/3379306 β†’

πŸ› Bug report
Status

Active

Version

1.16

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine proweb.ua

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @proweb.ua
  • Status changed to Closed: won't fix 11 months ago
  • πŸ‡¦πŸ‡ΊAustralia larowlan πŸ‡¦πŸ‡ΊπŸ.au GMT+10

    Drupal 9 is no longer supported, please update to Drupal 10

    Thanks

  • πŸ‡¦πŸ‡ͺUnited Arab Emirates leslie.cordell Dubai

    I came across this error, but from a different project, but want to add a quick resolution here.

    While I agree, sites need to be upgraded 100%, in some instances where larger project migrations are still going through UAT or lengthy pauses, their existing sites still need to be maintained and kept in working order until that time comes.

    One resolution to this is to back port the DeprecationHelper.php file into Drupal 9 as a composer "post-install-cmd", an example of this could be.

    Download and copy the DeprecationHelper.php file to a directory at the project root i.e. ./scripts so you end up with ./scripts/DeprecationHelper.php

    Make a note to remove this when upgrading to Drupal 10.

    Then add the following to composer.json

    "scripts": {
      "post-install-cmd": [
        "cp ./scripts/DeprecationHelper.php ./web/core/lib/Drupal/Component/Utility"
      ]
    }
    

    This is a nicer solution and better than patching every module. This is working for us. Just remember to pull this out during upgrade. Customize as you see fit.

Production build 0.71.5 2024