Issue Bug Closed

#81773Empty constants are not correct replaced after Patch

Pascal Hinz 07/03/17, 16:35 updated 10/02/18, 10:58

Description

After the Patch (https://github.com/TYPO3/TYPO3.CMS/commit/ac9baec4461c232e1a88d181da14f53f6146a8d5) “Prevent different constants marker in TS parsing” empty constants are not replaced correct.
The markers (##11f99e_B####11f99e_E##) are left after the replacing process and are visible in the TypoScript Template ObjectBrowser (see screenshots).
It seems that the bug doesn’t have any effects on the functionality of the TYPO3 instance.

How to reproduce:
1 ) Open the Typoscript ObjectBrowser in the setup mode
2) Disable the option “Crop lines“
3) Select “Substituted constants in green“
4) Type in the search “_B##” and you will find in the result something like “##64e3d7_B####64e3d7_E##”

How to fix:
1) Just fix the regular expression in the ExtendedTemplateService.php

TYPO3 7.6.19
File: typo3_src-7.6.19/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php (line 320):
Replace: ‘/##[a-z0-9]{6}_B##((?:(?!##[a-z0-9]{6}_E##).)+)##[a-z0-9]{6}_E##/’,
With: ‘/##[a-z0-9]{6}_B##((?:(?!##[a-z0-9]{6}_E##).)+)?##[a-z0-9]{6}_E##/’,

TYPO3 8.7.2
File: typo3_src-8.7.2/typo3/sysext/core/Classes/TypoScript/ExtendedTemplateService.php (line 316)
Replace: ‘/##[a-z0-9]{6}_B##((?:(?!##[a-z0-9]{6}_E##).)+)##[a-z0-9]{6}_E##/’,
With: ‘/##[a-z0-9]{6}_B##((?:(?!##[a-z0-9]{6}_E##).)+)?##[a-z0-9]{6}_E##/’,

I’ll try to make a patch for the bug.

Reviews 3