Commit cd6df0df authored by Chris Müller's avatar Chris Müller Committed by Andreas Fernandez
Browse files

[BUGFIX] Avoid undefined array key in LegacyLinkNotationConverter

This error occurs when running linkvalidator in scheduler:
Undefined array key 1.

Resolves: #96439
Releases: main, 11.5
Change-Id: Idbe4b5bf52722a800026fc7af566daba925eaad2
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72837


Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent 62ada6fa
......@@ -168,13 +168,13 @@ class LegacyLinkNotationConverter
} elseif (str_contains($data, '&')) {
[$data, $result['parameters']] = explode('&', $data, 2);
}
$data = rtrim($data, ',');
if (empty($data)) {
$result['pageuid'] = 'current';
} elseif ($data[0] === '#') {
$result['pageuid'] = 'current';
$result['fragment'] = substr($data, 1);
} elseif (str_contains($data, ',')) {
$data = rtrim($data, ',');
[$result['pageuid'], $result['pagetype']] = explode(',', $data, 2);
} elseif (str_contains($data, '/')) {
$data = explode('/', trim($data, '/'));
......
......@@ -55,6 +55,14 @@ class LegacyLinkNotationConverterTest extends UnitTestCase
// final unified URN
't3://page?uid=13',
],
'simple page - old style with appended comma' => [
'13,',
[
'type' => LinkService::TYPE_PAGE,
'pageuid' => 13,
],
't3://page?uid=13',
],
'page with type - old style' => [
'13,31',
[
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment