Project

General

Profile

Actions

Bug #98537

closed

PHP Warning: Undefined array key 1 in typo3_src-11.5.16/typo3/sysext/core/Classes/Utility/GeneralUtility.php line 1082

Added by Ralph Brugger about 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Miscellaneous
Target version:
-
Start date:
2022-10-05
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Example:

$parsedUrl = GeneralUtility::explodeUrl2Array('https://www.foobar.de/de/newsletter/taeglich/vom-22-september-2022/?&pk_medium=newsletter&pk_campaign=220922_newsletter_daily&pk_source=newsletter_daily&pk_keyword=');
   public static function explodeUrl2Array($string)
    {
        $output = [];
        $p = explode('&', $string);
        foreach ($p as $v) {
            if ($v !== '') {
                [$pK, $pV] = explode('=', $v, 2);
                $output[rawurldecode($pK)] = rawurldecode($pV);

            }
        }
        return $output;
    }

should be changed into:

   public static function explodeUrl2Array($string)
    {
        $output = [];
        $p = explode('&', $string);
        foreach ($p as $v) {
            if ($v !== '') {
                $arValues = explode('=', $v, 2);
                $output[rawurldecode($arValues[0])] = isset($arValues[1]) ? rawurldecode($arValues[1]) : '';

            }
        }
        return $output;
    }

Actions

Also available in: Atom PDF