diff --git a/typo3/sysext/core/Configuration/DefaultConfiguration.php b/typo3/sysext/core/Configuration/DefaultConfiguration.php index 712dc2496108a7a1d8652fd7ef35bc65cb8bba51..d65fcee76c5ec1ea58b9c1ddcd1ae4cf5a4acd70 100644 --- a/typo3/sysext/core/Configuration/DefaultConfiguration.php +++ b/typo3/sysext/core/Configuration/DefaultConfiguration.php @@ -364,6 +364,7 @@ return [ \TYPO3Fluid\Fluid\Core\Parser\TemplateProcessor\EscapingModifierTemplateProcessor::class, \TYPO3Fluid\Fluid\Core\Parser\TemplateProcessor\PassthroughSourceModifierTemplateProcessor::class, \TYPO3Fluid\Fluid\Core\Parser\TemplateProcessor\NamespaceDetectionTemplateProcessor::class, + \TYPO3Fluid\Fluid\Core\Parser\TemplateProcessor\RemoveCommentsTemplateProcessor::class, ], 'expressionNodeTypes' => [ \TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\CastingExpressionNode::class, diff --git a/typo3/sysext/core/Documentation/Changelog/13.3/Feature-104904-IgnoreFluidSyntaxErrorInFComment.rst b/typo3/sysext/core/Documentation/Changelog/13.3/Feature-104904-IgnoreFluidSyntaxErrorInFComment.rst new file mode 100644 index 0000000000000000000000000000000000000000..eb050920ba8eb21f312d17592df49372049a29db --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/13.3/Feature-104904-IgnoreFluidSyntaxErrorInFComment.rst @@ -0,0 +1,30 @@ +.. include:: /Includes.rst.txt + +.. _feature-104904-1726049662: + +=========================================================== +Feature: #104904 - Ignore Fluid syntax error in <f:comment> +=========================================================== + +See :issue:`104904` + +Description +=========== + +Fluid 4 brings a new template processor +:php:`TYPO3Fluid\Fluid\Core\Parser\TemplateProcessor\RemoveCommentsTemplateProcessor` +which removes Fluid comments created with :html:`<f:comment>` from the template source +string before the parsing process starts. It retains the original line breaks to ensure +that error messages still refer to the correct line in the template. + +By applying this template processor to all Fluid instances in the Core, it is now +possible to use invalid Fluid code inside :html:`<f:comment>` without triggering a Fluid error. + + +Impact +====== + +This feature is helpful during template development because developers don't need to +take care for commented-out code being valid Fluid code. + +.. index:: Fluid, ext:fluid diff --git a/typo3/sysext/fluid/Classes/Core/Rendering/RenderingContextFactory.php b/typo3/sysext/fluid/Classes/Core/Rendering/RenderingContextFactory.php index a7a43402583ea79dd6a7cd0d2d81ce40d0e4b0e0..e5417a4247d46bec24ff131c8c87ded126cd8eee 100644 --- a/typo3/sysext/fluid/Classes/Core/Rendering/RenderingContextFactory.php +++ b/typo3/sysext/fluid/Classes/Core/Rendering/RenderingContextFactory.php @@ -27,6 +27,7 @@ use TYPO3Fluid\Fluid\Core\Cache\FluidCacheInterface; use TYPO3Fluid\Fluid\Core\Parser\TemplateProcessor\EscapingModifierTemplateProcessor; use TYPO3Fluid\Fluid\Core\Parser\TemplateProcessor\NamespaceDetectionTemplateProcessor; use TYPO3Fluid\Fluid\Core\Parser\TemplateProcessor\PassthroughSourceModifierTemplateProcessor; +use TYPO3Fluid\Fluid\Core\Parser\TemplateProcessor\RemoveCommentsTemplateProcessor; use TYPO3Fluid\Fluid\Core\Parser\TemplateProcessorInterface; /** @@ -68,6 +69,7 @@ final readonly class RenderingContextFactory new EscapingModifierTemplateProcessor(), new PassthroughSourceModifierTemplateProcessor(), new NamespaceDetectionTemplateProcessor(), + new RemoveCommentsTemplateProcessor(), ]; } else { foreach ($GLOBALS['TYPO3_CONF_VARS']['SYS']['fluid']['preProcessors'] as $className) { diff --git a/typo3/sysext/fluid/Configuration/Services.yaml b/typo3/sysext/fluid/Configuration/Services.yaml index aed2f9271518e7856075b7e02842f862ef673cbe..ee83ea94a6819bc0841fab4295e7893e10ec2496 100644 --- a/typo3/sysext/fluid/Configuration/Services.yaml +++ b/typo3/sysext/fluid/Configuration/Services.yaml @@ -39,3 +39,7 @@ services: TYPO3Fluid\Fluid\Core\Parser\TemplateProcessor\NamespaceDetectionTemplateProcessor: public: true shared: false + TYPO3Fluid\Fluid\Core\Parser\TemplateProcessor\RemoveCommentsTemplateProcessor: + public: true + shared: false +