After upgrading to CiviCRM 5.44.0 under Drupal 9.2.10 under Windows/IIS I got the following error when trying to view a report:

Error: Class 'HTMLPurifier_Config' not found in CRM_Utils_String::purifyHTML() (line 634 of E:\drupal_test\vendor\civicrm\civicrm-core\CRM\Utils\String.php)

in one CiviCRM instance. I have another instance on another machine where the error did not occur. The 'offending' instance is a test environment but I daren't upgrade the live environment until I have an answer to the problem.

  • There was a change made but composer should work it out. I haven't seen a problem myself but it's composer so who knows since it does a different thing in each environment. github.com/civicrm/civicrm-packages/pull/334
    – Demerit
    Commented Dec 3, 2021 at 20:41
  • The problem only occurred when upgrading from 5.43.2 to 5.44.0. Is that when the new HTML_Purifier was used? Commented Dec 6, 2021 at 10:31
  • yes it was 5.44.0
    – Demerit
    Commented Dec 6, 2021 at 10:49

2 Answers 2


I got the error on 5.43.2. A search for HTMLPurifier_Config in the code turns up nothing.

When updating CiviCRM via composer make sure to update dependencies as well with:

composer update civicrm/civicrm-core --with-dependencies

The HTMLPurifier will then be installed this way.

  • That's strange because the above change was definitely 5.44.0 - the file is in the tree in 5.43.2, and then removed in 5.44.0. But yes if you only update civicrm/civicrm-core without specifying dependencies then there can be trouble. The downside to update with dependencies is it does different things depending on the environment, so you can end up with versions of libraries you don't want. Maybe that's what happened here and it decided to do 5.44.0? Composer does that sometimes.
    – Demerit
    Commented Dec 10, 2021 at 22:53
  • I ran composer with --update-with-all-dependencies and still got the issue. I'll wait for 5.44.1 before trying again. Commented Dec 12, 2021 at 18:27

I experienced this problem today (Drupal 9.3, Civi 5.44). For me, it was because I had an extension (advimport) that was causing issues. Even using the latest version, which is supposed to work with Civi 5.44 and even with it uninstalled, it caused problems. I'm guessing there's some part of the Composer autoloader that doesn't like the presence of a composer.json that references HTMLPurifier. In fact, the earlier version of advimport doesn't have this issue.

To fix this, I rolled back to a pre-Civi 5.44 commit, ran composer install, then moved forward to the commit before advimport. Even checking out the commit with the latest advimport, without composer install, replicated the bug for me.

UPDATE: The problem returned for me, even after removing advimport. However, restarting Apache/PHP/Redis fixed it for me (I did all three at once, so not sure which one worked).

  • "doesn't like the presence of a composer.json that references..." - that seems odd. Does your checkout include the vendor/composer folder? Since then that might explain at least some weirdness, since the autoloader would then be in a possibly mismatched state.
    – Demerit
    Commented Dec 27, 2021 at 23:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.