Commit a5f33ae6 authored by Oliver Bartsch's avatar Oliver Bartsch Committed by Benni Mack
Browse files

[!!!][TASK] Remove GeneralUtility::compileSelectedGetVarsFromArray

Since the only usage of this method was
already migrated, it is now removed.

Resolves: #96177
Related: #94252
Releases: main
Change-Id: I92c841cd00975e9def874b964eb5baf249e1e281
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72438


Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 31a0d7a2
......@@ -1015,35 +1015,6 @@ class GeneralUtility
return $output;
}
/**
* Returns an array with selected keys from incoming data.
* (Better read source code if you want to find out...)
*
* @param string $varList List of variable/key names
* @param array $getArray Array from where to get values based on the keys in $varList
* @param bool $GPvarAlt If set, then \TYPO3\CMS\Core\Utility\GeneralUtility::_GP() is used to fetch the value if not found (isset) in the $getArray
* @return array Output array with selected variables.
* @deprecated since v11, will be removed in v12.
*/
public static function compileSelectedGetVarsFromArray($varList, array $getArray, $GPvarAlt = true)
{
trigger_error(
'GeneralUtility::compileSelectedGetVarsFromArray() is deprecated and will be removed in v12.',
E_USER_DEPRECATED
);
$keys = self::trimExplode(',', $varList, true);
$outArr = [];
foreach ($keys as $v) {
if (isset($getArray[$v])) {
$outArr[$v] = $getArray[$v];
} elseif ($GPvarAlt) {
$outArr[$v] = self::_GP($v);
}
}
return $outArr;
}
/**
* Removes dots "." from end of a key identifier of TypoScript styled array.
* array('key.' => array('property.' => 'value')) --> array('key' => array('property' => 'value'))
......
......@@ -76,6 +76,7 @@ The following PHP static class methods that have previously been marked as depre
- :php:`\TYPO3\CMS\Core\Resource\Rendering\RendererRegistry::getInstance()`
- :php:`\TYPO3\CMS\Core\Resource\TextExtraction\TextExtractorRegistry::getInstance()`
- :php:`\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable()`
- :php:`\TYPO3\CMS\Core\Utility\GeneralUtility::compileSelectedGetVarsFromArray()`
- :php:`\TYPO3\CMS\Core\Utility\GeneralUtility::hideIfNotTranslated()`
- :php:`\TYPO3\CMS\Core\Utility\GeneralUtility::hideIfDefaultLanguage()`
- :php:`\TYPO3\CMS\Core\Utility\GeneralUtility::isFirstPartOfStr()`
......
<?php
declare(strict_types=1);
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Core\Tests\UnitDeprecated\Utility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
class GeneralUtilityTest extends UnitTestCase
{
/**
* @test
*/
public function compileSelectedGetVarsFromArrayFiltersIncomingData(): void
{
$filter = 'foo,bar';
$getArray = ['foo' => 1, 'cake' => 'lie'];
$expected = ['foo' => 1];
$result = GeneralUtility::compileSelectedGetVarsFromArray($filter, $getArray, false);
self::assertSame($expected, $result);
}
/**
* @test
*/
public function compileSelectedGetVarsFromArrayUsesGetPostDataFallback(): void
{
$_GET['bar'] = '2';
$filter = 'foo,bar';
$getArray = ['foo' => 1, 'cake' => 'lie'];
$expected = ['foo' => 1, 'bar' => '2'];
$result = GeneralUtility::compileSelectedGetVarsFromArray($filter, $getArray, true);
self::assertSame($expected, $result);
}
}
......@@ -1082,6 +1082,7 @@ return [
'maximumNumberOfArguments' => 3,
'restFiles' => [
'Deprecation-94252-DeprecatedGeneralUtilitycompileSelectedGetVarsFromArray.rst',
'Breaking-96107-DeprecatedFunctionalityRemoved.rst',
],
],
'TYPO3\CMS\Core\Utility\GeneralUtility::stdAuthCode' => [
......
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