Skip to content

Instantly share code, notes, and snippets.

@dmitryd
Created March 27, 2021 09:40
Show Gist options
  • Save dmitryd/b0d16aebb2388d62212a023c83decec6 to your computer and use it in GitHub Desktop.
Save dmitryd/b0d16aebb2388d62212a023c83decec6 to your computer and use it in GitHub Desktop.
TYPO3 9.5 patch for #93764: slugs in non-normalized Unicode can produce incorrect urls
commit 0657788b1e5e0b5ea382083637438fc50c22baf8
Author: Dmitry Dulepov <ddulepov@snowflake.ch>
Date: Wed Mar 17 13:47:07 2021 +0300
[BUGFIX] Slugs in non-normalized Unicode can produce incorrect urls
diff --git a/typo3/sysext/core/Classes/DataHandling/SlugHelper.php b/typo3/sysext/core/Classes/DataHandling/SlugHelper.php
index dccc65af7f..fb4e8ca46e 100644
--- a/typo3/sysext/core/Classes/DataHandling/SlugHelper.php
+++ b/typo3/sysext/core/Classes/DataHandling/SlugHelper.php
@@ -108,6 +108,10 @@ class SlugHelper
$fallbackCharacter = (string)($this->configuration['fallbackCharacter'] ?? '-');
$slug = preg_replace('/[ \t\x{00A0}\-+_]+/u', $fallbackCharacter, $slug);
+ if (!\Normalizer::isNormalized($slug)) {
+ $slug = \Normalizer::normalize($slug);
+ }
+
// Convert extended letters to ascii equivalents
// The specCharsToASCII() converts "€" to "EUR"
$slug = GeneralUtility::makeInstance(CharsetConverter::class)->specCharsToASCII('utf-8', $slug);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment