Skip to content

Fix Mautic 7.2 EncryptionHelper injection and cover integration instantiation - #14

Open
AlexanderZlobinM1 wants to merge 1 commit into
FireMultimedia:mainfrom
AlexanderZlobinM1:fix/mautic-72-encryption-reference
Open

Fix Mautic 7.2 EncryptionHelper injection and cover integration instantiation#14
AlexanderZlobinM1 wants to merge 1 commit into
FireMultimedia:mainfrom
AlexanderZlobinM1:fix/mautic-72-encryption-reference

Conversation

@AlexanderZlobinM1

Copy link
Copy Markdown

Mautic 7.2.0 no longer registers mautic.helper.encryption, so this plugin prevents a fresh container from compiling. This fixes the service reference for hCaptcha, reCAPTCHA and Turnstile by registering a plugin-scoped alias for the existing EncryptionHelper service in Config/services.php and using that alias in the legacy integration argument lists.

Fixes #11. Related to #12: I tested its exact commit 39ce1b2ee81141aa800b8876961420b3e96be30a on a Mautic 7.2.0 installation. It fixes container compilation, but creating the integration then fails:

AbstractIntegration::__construct(): Argument #8 ($encryptionHelper) must be of type Mautic\CoreBundle\Helper\EncryptionHelper, string given

Mautic's ServicePass::processArgument() treats arguments containing a backslash as literal class-name strings, so putting EncryptionHelper::class directly in Config/config.php does not inject the service. The local alias avoids that legacy-parser behavior without restoring a global core alias or creating a second helper instance.

The included regression script compiles a fresh container and actually retrieves all three integration services; compilation alone would miss the failure in #12. Its temporary cache is removed afterward. Both legacy argument lists use the same alias; the CAPTCHA logic and existing settings are unchanged.

Validation on a Mautic 7.2.0 / PHP 8.4.23 server:

  • Current main (a1c1795): reproduced the missing mautic.helper.encryption error.
  • PR Fix service id for EncryptionHelper broken by Mautic 7.2.0 #12 (39ce1b2): reproduced the constructor TypeError above.
  • This change: the committed regression script passes for hCaptcha, reCAPTCHA and Turnstile.
  • Normal cache:clear --env=prod --no-debug succeeds.
  • PHP syntax checks, strict Composer validation and git diff --check pass.

Older Mautic versions and live provider challenge verification have not been runtime-tested in this contribution.

@tvalimaa

Copy link
Copy Markdown

Code looks good and valid

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