Bug #99023
closed
Regular expression is not escaped and causes errors
Added by Dmitry Dulepov about 2 years ago.
Updated almost 2 years ago.
Description
In ExtensionManagementUtility
:
switch ($positionIdentifier) {
case 'after':
case 'before':
if (preg_match('/\\b' . $entityName . '\\b/', $palette['showitem']) > 0 || $entityName === 'palette:' . $paletteName) {
Function parameter $position
is set to 'before:--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.media'
.
Variable $entityName
becomes '--div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.media'
Called from https://github.com/georgringer/eventnews/blob/main/Configuration/TCA/Overrides/tx_news_domain_model_news.php#L102
Result is an exception:
[ TYPO3\CMS\Core\Error\Exception ]
Warning: preg_match(): Unknown modifier 'R' in /var/www/html/html/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php line 277
Files
There is the same unquoted regexp couple of lines below in that function.
diff --git a/Classes/Utility/ExtensionManagementUtility.php b/Classes/Utility/ExtensionManagementUtility.php
index 629978dce..522399ff4 100644
--- a/Classes/Utility/ExtensionManagementUtility.php
+++ b/Classes/Utility/ExtensionManagementUtility.php
@@ -274,7 +274,7 @@ class ExtensionManagementUtility
switch ($positionIdentifier) {
case 'after':
case 'before':
- if (preg_match('/\\b' . $entityName . '\\b/', $palette['showitem']) > 0 || $entityName === 'palette:' . $paletteName) {
+ if (preg_match('/\\b' . preg_quote($entityName, '/') . '\\b/', $palette['showitem']) > 0 || $entityName === 'palette:' . $paletteName) {
$newPosition = $positionIdentifier . ':--palette--;;' . $paletteName;
}
break;
@@ -284,7 +284,7 @@ class ExtensionManagementUtility
$fieldExists = true;
continue 2;
}
- if (preg_match('/\\b' . $entityName . '\\b/', $palette['showitem']) > 0) {
+ if (preg_match('/\\b' . preg_quote($entityName, '/') . '\\b/', $palette['showitem']) > 0) {
self::addFieldsToPalette($table, $paletteName, $newFieldsString, $position);
// Memorize that we already changed this palette, in case other types also use it
$palettesChanged[$paletteName] = true;
- Related to Bug #98960: Migration from switchable Controller Actions incomplete added
- Status changed from New to Under Review
- Description updated (diff)
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF