Heads up if you’re updating Mautic from 7.0.1 to 7.1.x and suddenly find your entire site offline with a vague error like “The site is currently offline due to encountering an error.” This isn’t your everyday hiccup — it’s due to a clash with Twig, the templating engine Mautic relies on.
What happened? When updating, Composer pulls in newer versions of Twig (from 3.23.0 to 3.28.0 in this case). Twig 3.28 changed the return type of its include() function to sometimes return a Twig\Markup object instead of a plain string. Mautic’s override of this method, includeWithEvent(), still expects a string return type. This mismatch triggers a PHP TypeError that crashes the site rendering—even on the login page—locking you out completely.
The frustrating part: You can’t just pin Twig back to the old safe version because security advisories flag it as insecure. Also, dependencies like oneup/uploader-bundle allow newer Twig versions anyway, so the problem keeps coming back with each Composer update.
What’s the fix? A quick workaround folks found is to cast the return value to a string explicitly by editing app/bundles/CoreBundle/Twig/Extension/OverrideIncludeExtension.php. This bypasses the type error since Twig\Markup supports __toString(), so the output stays visually identical. The better long-term fix is to adjust Mautic’s method declarations to accept Twig\Markup or cast appropriately in core. But until the Mautic team ships an official fix, Composer updates will overwrite your patch, so you’ll need to reapply it after updates.
If you hit this, clear your cache after patching to fully restore the site. The community is aware and watching for an official fix, but this catches a lot of users off guard because the site is completely down with no fallback.
In practical terms for marketers and admins: This shows how reliant Mautic is on underlying PHP libraries and how a small change in a popular dependency (Twig) can break your whole setup unexpectedly. Until the fix lands in Mautic core, manual patching—or avoiding updates for now—is your safest bet.
Want the gritty details and community discussion? Check out the original forum thread here.
If you want to skip these low-level troubles entirely and keep your Mautic running smoothly, consider Mailertizer’s hosted Mautic platform. We handle all updates, dependencies, and technical headaches for you—so you can keep focusing on marketing.