Skip to content

Fix service id for EncryptionHelper broken by Mautic 7.2.0 - #12

Closed
back-2-95 wants to merge 1 commit into
FireMultimedia:mainfrom
back-2-95:fix/encryption-helper-service-id
Closed

Fix service id for EncryptionHelper broken by Mautic 7.2.0#12
back-2-95 wants to merge 1 commit into
FireMultimedia:mainfrom
back-2-95:fix/encryption-helper-service-id

Conversation

@back-2-95

Copy link
Copy Markdown

Summary

Fixes #11.

Mautic 7.2.0 refactored CoreBundle's service registration (see mautic/mautic#16841) and dropped the legacy mautic.helper.encryption alias for EncryptionHelper. Sibling helpers (CookieHelper, FileUploader, etc.) kept their aliases in that refactor, so this looks like an oversight on Mautic's side rather than an intentional break — but regardless, this plugin's Config/config.php hardcodes the now-missing string id, which breaks container compilation on 7.2.0:

The service "mautic.integration.hcaptcha" has a dependency on a non-existent service "mautic.helper.encryption".

Fix

Reference \Mautic\CoreBundle\Helper\EncryptionHelper::class directly instead of the string service id. Autodiscovery has always registered classes under their FQCN in addition to any legacy alias, so this class-based id has been valid since at least Mautic 5.x — meaning this change fixes 7.2+ without affecting compatibility with 5.x/6.x/7.1.

Test plan

  • php -l Config/config.php passes
  • Verify container compiles and the Hcaptcha/Recaptcha/Turnstile integrations load correctly on a Mautic 7.2.0 install
  • Sanity check on Mautic 5.x/6.x/7.1 to confirm no regression

Mautic 7.2.0 refactored CoreBundle service registration and dropped the
legacy "mautic.helper.encryption" alias for EncryptionHelper, so the
container fails to compile with:

  The service "mautic.integration.hcaptcha" has a dependency on a
  non-existent service "mautic.helper.encryption".

Reference the class directly instead of the removed string id. The
class-based service id has been valid since at least Mautic 5.x, so
this keeps compatibility with 5.x/6.x/7.x, not just 7.2+.

Fixes FireMultimedia#11
@AlexanderZlobinM1

Copy link
Copy Markdown

I tested commit 39ce1b2ee81141aa800b8876961420b3e96be30a on Mautic 7.2.0 / PHP 8.4.23. Container compilation succeeds, but retrieving mautic.integration.hcaptcha fails with AbstractIntegration::__construct(): Argument #8 ($encryptionHelper) must be of type Mautic\CoreBundle\Helper\EncryptionHelper, string given.

ServicePass::processArgument() treats strings containing a backslash as literal class names, so the FQCN in the legacy argument array is not converted into a service reference. I submitted #14 using a plugin-scoped alias defined in Config/services.php, plus a regression script that instantiates all three integrations. That version passes on the same installation, including a normal production cache rebuild.

@back-2-95

Copy link
Copy Markdown
Author

Closed in favor of #14

@back-2-95 back-2-95 closed this Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mautic 7.2.0 error

2 participants