From e487eb43b6c55f2451cb6a4cf5aa982db1b70b63 Mon Sep 17 00:00:00 2001
From: Dominic Petit <dominic.petit@usherbrooke.ca>
Date: Tue, 22 Aug 2023 13:41:42 -0400
Subject: [PATCH] [BUGFIX] Allow comma and semicolon in TelephoneLinkHandler

Allow to save a phone link with a comma or a semicolon.

Resolves: #101721
Releases: main, 12.4, 11.5
Change-Id: I54e19fbfb2b1b184db4454a19728f08e70cddc4a
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80655
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../core/Classes/LinkHandling/TelephoneLinkHandler.php   | 2 +-
 .../Tests/Unit/LinkHandling/TelephoneLinkHandlerTest.php | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/typo3/sysext/core/Classes/LinkHandling/TelephoneLinkHandler.php b/typo3/sysext/core/Classes/LinkHandling/TelephoneLinkHandler.php
index 6f062ee18781..1fe0fc426f1c 100644
--- a/typo3/sysext/core/Classes/LinkHandling/TelephoneLinkHandler.php
+++ b/typo3/sysext/core/Classes/LinkHandling/TelephoneLinkHandler.php
@@ -30,7 +30,7 @@ class TelephoneLinkHandler implements LinkHandlingInterface
      */
     public function asString(array $parameters): string
     {
-        $telephoneNumber = preg_replace('/(?:[^\d\+]+)/', '', $parameters['telephone']);
+        $telephoneNumber = preg_replace('/(?:[^\d\+,;]+)/', '', $parameters['telephone']);
 
         return 'tel:' . $telephoneNumber;
     }
diff --git a/typo3/sysext/core/Tests/Unit/LinkHandling/TelephoneLinkHandlerTest.php b/typo3/sysext/core/Tests/Unit/LinkHandling/TelephoneLinkHandlerTest.php
index 1b36ba5f932c..0b9c1c1989a7 100644
--- a/typo3/sysext/core/Tests/Unit/LinkHandling/TelephoneLinkHandlerTest.php
+++ b/typo3/sysext/core/Tests/Unit/LinkHandling/TelephoneLinkHandlerTest.php
@@ -69,6 +69,15 @@ class TelephoneLinkHandlerTest extends UnitTestCase
                 ],
                 'tel:+43123455678',
             ],
+            'telephone number with comma and semicolon' => [
+                [
+                    'telephone' => 'tel:+43 123 45 56 78,; 1234',
+                ],
+                [
+                    'telephone' => '+43 123 45 56 78,; 1234',
+                ],
+                'tel:+43123455678,;1234',
+            ],
         ];
     }
 
-- 
GitLab