If you just tried updating your Mautic instance from 7.0.1 to 7.1.2 and got hit with a “site offline due to error” message, you’re not alone. There’s a snag related to Twig—Mautic’s templating engine—that’s tripping up the whole site, including the login pages. Here’s the lowdown and what you can do about it.
The culprit is a change in Twig itself. When your update pulled Twig from version 3.23 to 3.28, it introduced a subtle but breaking change. The core Twig include() function switched to returning a Twig\Markup object instead of a plain string in some cases. Trouble is, Mautic’s OverrideIncludeExtension::includeWithEvent() method is declared to return a string, but it now gets that Twig\Markup object directly from Twig. PHP freaks out about that return type mismatch and stops rendering templates entirely—starting with all important login pages. No login, no access, full site down.
Temporarily downgrading Twig back to 3.23 is a no-go since security advisories block it, and one of Mautic’s dependencies also wants a newer Twig version. So that leaves code fixes.
The quick temporary fix is simple: cast the return from Twig’s include() to a string in OverrideIncludeExtension.php. Because Twig\Markup has a __toString() method, this results in the same rendered output but keeps PHP happy. This fix restores access and rendering—perfect for getting you back online fast.
Longer term, Mautic’s method signature needs updating to accept Twig\Markup, or the returned value should always be cast to string within the core code. Until an official fix lands, you’ll have to reapply that cast after each composer update to avoid getting locked out.
Why should you care? Because this kind of dependency mismatch is exactly why Mautic updates—especially minor version bumps—can sometimes break sites unexpectedly. It’s a reminder to keep an eye on your Twig version and be ready to debug templating errors, especially after upgrades.
If this sounds like a headache you’d rather skip, that’s one of the perks of hosted services like Mailertizer: we handle tricky backend dependency issues for you, so you never get stuck with a broken site after updating.
For the full technical thread and community discussion, you can check out the original Mautic forum topic here.