From 00b97d7ff9b2ac3dd5afe1149ae10a4c65ab9744 Mon Sep 17 00:00:00 2001 From: Sascha Egerer <sascha@sascha-egerer.de> Date: Sat, 18 Feb 2017 16:58:33 +0100 Subject: [PATCH] [CLEANUP] Ensure variables initalized and fix code smell * Ensure that variables are correctly initalized. * Fix some php docs. * Initalizes for loop iterator variables before the loop if they are also used after the for loop is finished. * Remove superfluous function arguments. Resolves: #79892 Releases: master Change-Id: I75109b2914f2b05806a303837b7aad79be8e3707 Reviewed-on: https://review.typo3.org/51742 Reviewed-by: Thomas Hohn <thomas@hohn.dk> Tested-by: Thomas Hohn <thomas@hohn.dk> Tested-by: TYPO3com <no-reply@typo3.com> Reviewed-by: Christer V <cvi@systime.dk> Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch> Tested-by: Christian Kuhn <lolli@schwarzbu.ch> --- .../core/Classes/Charset/CharsetConverter.php | 15 +++++++---- .../Configuration/FlexForm/FlexFormTools.php | 1 + .../AbstractConditionMatcher.php | 3 +++ .../Controller/CommandLineController.php | 1 + .../core/Classes/DataHandling/DataHandler.php | 7 +++-- .../core/Classes/Database/QueryGenerator.php | 17 +++++++----- .../core/Classes/Database/QueryView.php | 1 + .../Classes/ExtDirect/ExtDirectRouter.php | 27 ++++++++++--------- .../FrontendEditingController.php | 1 + .../core/Classes/Html/RteHtmlParser.php | 3 ++- typo3/sysext/core/Classes/Http/Response.php | 2 +- .../Classes/Localization/LanguageStore.php | 2 +- .../Parser/LocallangXmlParser.php | 2 +- .../Package/MetaData/PackageConstraint.php | 12 +++++++++ .../Service/DependencyOrderingService.php | 2 +- .../core/Classes/TimeTracker/TimeTracker.php | 1 + .../Classes/TypoScript/ConfigurationForm.php | 2 +- .../core/Classes/Utility/CommandUtility.php | 3 ++- .../Utility/File/ExtendedFileUtility.php | 2 +- .../core/Classes/Utility/GeneralUtility.php | 5 ++-- .../core/Tests/Unit/Http/UploadedFileTest.php | 2 +- .../core/Tests/Unit/Resource/FolderTest.php | 2 +- .../Tests/Unit/Utility/ArrayUtilityTest.php | 2 +- 23 files changed, 73 insertions(+), 42 deletions(-) diff --git a/typo3/sysext/core/Classes/Charset/CharsetConverter.php b/typo3/sysext/core/Classes/Charset/CharsetConverter.php index bfababa89934..772bd2b1119a 100644 --- a/typo3/sysext/core/Classes/Charset/CharsetConverter.php +++ b/typo3/sysext/core/Classes/Charset/CharsetConverter.php @@ -688,8 +688,9 @@ class CharsetConverter implements SingletonInterface // This verifies that it IS a multi byte string if (($ord & 192) === 192) { $binBuf = ''; + $b = 0; // For each byte in multibyte string... - for ($b = 0; $b < 8; $b++) { + for (; $b < 8; $b++) { // Shift it left and ... $ord = $ord << 1; // ... and with 8th bit - if that is set, then there are still bytes in sequence. @@ -1432,8 +1433,9 @@ class CharsetConverter implements SingletonInterface if ($i <= 0) { return ''; } + $bc = 0; // Sanity check - for ($bc = 0, $mbs = ord($str[$i]); $mbs & 128; $mbs = $mbs << 1) { + for ($mbs = ord($str[$i]); $mbs & 128; $mbs = $mbs << 1) { // Calculate number of bytes $bc++; } @@ -1536,7 +1538,8 @@ class CharsetConverter implements SingletonInterface GeneralUtility::logDeprecatedFunction(); // Number of characters $n = 0; - for ($i = $pos; $i > 0; $i--) { + $i = $pos; + for (; $i > 0; $i--) { $c = (int)ord($str[$i]); // single-byte (0xxxxxx) if (!($c & 128)) { @@ -1585,8 +1588,9 @@ class CharsetConverter implements SingletonInterface if (!($c & 128)) { $mbc = $str[$i]; } elseif (($c & 192) === 192) { + $bc = 0; // multi-byte starting byte (11xxxxxx) - for ($bc = 0; $c & 128; $c = $c << 1) { + for (; $c & 128; $c = $c << 1) { $bc++; } // calculate number of bytes @@ -1627,7 +1631,8 @@ class CharsetConverter implements SingletonInterface { GeneralUtility::logDeprecatedFunction(); $shiftJis = $charset === 'shift_jis'; - for ($i = 0; isset($str[$i]) && $i < $len; $i++) { + $i = 0; + for (; isset($str[$i]) && $i < $len; $i++) { $c = ord($str[$i]); if ($shiftJis) { if ($c >= 128 && $c < 160 || $c >= 224) { diff --git a/typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php b/typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php index 1399622c1455..ff28f69b211e 100644 --- a/typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php +++ b/typo3/sysext/core/Classes/Configuration/FlexForm/FlexFormTools.php @@ -110,6 +110,7 @@ class FlexFormTools */ public function getDataStructureIdentifier(array $fieldTca, string $tableName, string $fieldName, array $row): string { + $dataStructureIdentifier = null; // Hook to inject an own logic to point to a data structure elsewhere. // A hook has to implement method getDataStructureIdentifierPreProcess() to be called here. // All hooks are called in a row, each MUST return an array, and the FIRST one that diff --git a/typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php b/typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php index 5275c5f639f9..cca7d8866d31 100644 --- a/typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php +++ b/typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php @@ -272,6 +272,9 @@ abstract class AbstractConditionMatcher case 'dayofyear': $theTestValue = date('z', $theEvalTime); break; + default: + $theTestValue = 0; + break; } $theTestValue = (int)$theTestValue; // comp diff --git a/typo3/sysext/core/Classes/Controller/CommandLineController.php b/typo3/sysext/core/Classes/Controller/CommandLineController.php index 7dee4a10adb1..e5686b014eb3 100644 --- a/typo3/sysext/core/Classes/Controller/CommandLineController.php +++ b/typo3/sysext/core/Classes/Controller/CommandLineController.php @@ -157,6 +157,7 @@ class CommandLineController $allOptions[] = $cfg[0]; $argSplit = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(' ', $cfg[0], true); if (isset($cli_args_copy[$argSplit[0]])) { + $ii = 0; foreach ($argSplit as $i => $v) { $ii = $i; if ($i > 0) { diff --git a/typo3/sysext/core/Classes/DataHandling/DataHandler.php b/typo3/sysext/core/Classes/DataHandling/DataHandler.php index 0e2a205fba26..7e2f10283c52 100644 --- a/typo3/sysext/core/Classes/DataHandling/DataHandler.php +++ b/typo3/sysext/core/Classes/DataHandling/DataHandler.php @@ -5612,13 +5612,11 @@ class DataHandler 'label' => $label, ]; return $this->copyRecord_raw($table, $id, -1, $overrideArray, $workspaceOptions); + } // Reuse the existing record and return its uid // (prior to TYPO3 CMS 6.2, an error was thrown here, which // did not make much sense since the information is available) - } else { - return $versionRecord['uid']; - } - return null; + return $versionRecord['uid']; } /** @@ -5903,6 +5901,7 @@ class DataHandler // If record has been versioned/copied in this process, handle invalid relations of the live record $liveId = BackendUtility::getLiveVersionIdOfRecord($table, $MM_localUid); + $originalId = 0; if (!empty($this->copyMappingArray_merged[$table])) { $originalId = array_search($MM_localUid, $this->copyMappingArray_merged[$table]); } diff --git a/typo3/sysext/core/Classes/Database/QueryGenerator.php b/typo3/sysext/core/Classes/Database/QueryGenerator.php index 74b258f5f0b5..3ab572c7ca4e 100644 --- a/typo3/sysext/core/Classes/Database/QueryGenerator.php +++ b/typo3/sysext/core/Classes/Database/QueryGenerator.php @@ -437,7 +437,8 @@ class QueryGenerator $ssArr = $this->getSubscript($POST['qG_del']); $workArr = &$this->queryConfig; $ssArrSize = count($ssArr) - 1; - for ($i = 0; $i < $ssArrSize; $i++) { + $i = 0; + for (; $i < $ssArrSize; $i++) { $workArr = &$workArr[$ssArr[$i]]; } // Delete the entry and move the other entries @@ -454,7 +455,8 @@ class QueryGenerator $ssArr = $this->getSubscript($POST['qG_ins']); $workArr = &$this->queryConfig; $ssArrSize = count($ssArr) - 1; - for ($i = 0; $i < $ssArrSize; $i++) { + $i = 0; + for (; $i < $ssArrSize; $i++) { $workArr = &$workArr[$ssArr[$i]]; } // Move all entries above position where new entry is to be inserted @@ -472,7 +474,8 @@ class QueryGenerator $ssArr = $this->getSubscript($POST['qG_up']); $workArr = &$this->queryConfig; $ssArrSize = count($ssArr) - 1; - for ($i = 0; $i < $ssArrSize; $i++) { + $i = 0; + for (; $i < $ssArrSize; $i++) { $workArr = &$workArr[$ssArr[$i]]; } // Swap entries @@ -486,7 +489,8 @@ class QueryGenerator $ssArr = $this->getSubscript($POST['qG_nl']); $workArr = &$this->queryConfig; $ssArraySize = count($ssArr) - 1; - for ($i = 0; $i < $ssArraySize; $i++) { + $i = 0; + for (; $i < $ssArraySize; $i++) { $workArr = &$workArr[$ssArr[$i]]; } // Do stuff: @@ -507,7 +511,8 @@ class QueryGenerator $ssArr = $this->getSubscript($POST['qG_remnl']); $workArr = &$this->queryConfig; $ssArrSize = count($ssArr) - 1; - for ($i = 0; $i < $ssArrSize; $i++) { + $i = 0; + for (; $i < $ssArrSize; $i++) { $workArr = &$workArr[$ssArr[$i]]; } // Do stuff: @@ -879,7 +884,6 @@ class QueryGenerator $from_table_Arr[0] = $fieldSetup['foreign_table']; } $counter = 0; - $webMountPageTree = ''; $tablePrefix = ''; $backendUserAuthentication = $this->getBackendUserAuthentication(); $module = $this->getModule(); @@ -905,6 +909,7 @@ class QueryGenerator } $useSelectLabels = true; } + $altLabelFieldSelect = []; if ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items']) { foreach ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items'] as $altLabelArray) { if (substr($altLabelArray[0], 0, 4) === 'LLL:') { diff --git a/typo3/sysext/core/Classes/Database/QueryView.php b/typo3/sysext/core/Classes/Database/QueryView.php index c0dbcbae9969..dac343db9261 100644 --- a/typo3/sysext/core/Classes/Database/QueryView.php +++ b/typo3/sysext/core/Classes/Database/QueryView.php @@ -1058,6 +1058,7 @@ class QueryView } $useSelectLabels = 1; } + $altLabelFieldSelect = []; if ($GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items']) { $items = $GLOBALS['TCA'][$from_table]['columns'][$altLabelField]['config']['items']; foreach ($items as $altLabelArray) { diff --git a/typo3/sysext/core/Classes/ExtDirect/ExtDirectRouter.php b/typo3/sysext/core/Classes/ExtDirect/ExtDirectRouter.php index 31d32b992f74..e981d8959ecc 100644 --- a/typo3/sysext/core/Classes/ExtDirect/ExtDirectRouter.php +++ b/typo3/sysext/core/Classes/ExtDirect/ExtDirectRouter.php @@ -119,21 +119,22 @@ class ExtDirectRouter protected function processRpc($singleRequest, $namespace) { $endpointName = $namespace . '.' . $singleRequest->action; - if (!isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'][$endpointName])) { + if ( + !isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'][$endpointName]) + || !is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'][$endpointName]) + ) { throw new \UnexpectedValueException('ExtDirect: Call to undefined endpoint: ' . $endpointName, 1294586450); } - if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'][$endpointName])) { - if (!isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'][$endpointName]['callbackClass'])) { - throw new \UnexpectedValueException('ExtDirect: Call to undefined endpoint: ' . $endpointName, 1294586451); - } - $callbackClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'][$endpointName]['callbackClass']; - $configuration = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'][$endpointName]; - if (!is_null($configuration['moduleName']) && !is_null($configuration['accessLevel'])) { - $GLOBALS['BE_USER']->modAccess([ - 'name' => $configuration['moduleName'], - 'access' => $configuration['accessLevel'] - ], true); - } + if (!isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'][$endpointName]['callbackClass'])) { + throw new \UnexpectedValueException('ExtDirect: Call to undefined endpoint: ' . $endpointName, 1294586451); + } + $callbackClass = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'][$endpointName]['callbackClass']; + $configuration = $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ExtDirect'][$endpointName]; + if (!is_null($configuration['moduleName']) && !is_null($configuration['accessLevel'])) { + $GLOBALS['BE_USER']->modAccess([ + 'name' => $configuration['moduleName'], + 'access' => $configuration['accessLevel'] + ], true); } $endpointObject = GeneralUtility::getUserObj($callbackClass); return call_user_func_array([$endpointObject, $singleRequest->method], is_array($singleRequest->data) ? $singleRequest->data : []); diff --git a/typo3/sysext/core/Classes/FrontendEditing/FrontendEditingController.php b/typo3/sysext/core/Classes/FrontendEditing/FrontendEditingController.php index d6847887c59e..d03429378fc7 100644 --- a/typo3/sysext/core/Classes/FrontendEditing/FrontendEditingController.php +++ b/typo3/sysext/core/Classes/FrontendEditing/FrontendEditingController.php @@ -80,6 +80,7 @@ class FrontendEditingController list($table, $uid) = explode(':', $currentRecord); // Page ID for new records, 0 if not specified $newRecordPid = (int)$conf['newRecordInPid']; + $newUid = null; if (!$conf['onlyCurrentPid'] || $dataArray['pid'] == $GLOBALS['TSFE']->id) { if ($table === 'pages') { $newUid = $uid; diff --git a/typo3/sysext/core/Classes/Html/RteHtmlParser.php b/typo3/sysext/core/Classes/Html/RteHtmlParser.php index 4d64c2602b70..e04e9dbff19d 100644 --- a/typo3/sysext/core/Classes/Html/RteHtmlParser.php +++ b/typo3/sysext/core/Classes/Html/RteHtmlParser.php @@ -1098,7 +1098,8 @@ class RteHtmlParser extends HtmlParser } else { $curURL = GeneralUtility::getIndpEnv('TYPO3_SITE_URL'); $urlLength = strlen($url); - for ($a = 0; $a < $urlLength; $a++) { + $a = 0; + for (; $a < $urlLength; $a++) { if ($url[$a] != $curURL[$a]) { break; } diff --git a/typo3/sysext/core/Classes/Http/Response.php b/typo3/sysext/core/Classes/Http/Response.php index 893db55b0d11..92ced4b3b2d9 100644 --- a/typo3/sysext/core/Classes/Http/Response.php +++ b/typo3/sysext/core/Classes/Http/Response.php @@ -134,7 +134,7 @@ class Response extends Message implements ResponseInterface $this->statusCode = (int)$statusCode; $this->reasonPhrase = $this->availableStatusCodes[$this->statusCode]; - list($this->headerNames, $headers) = $this->filterHeaders($headers); + $headers = $this->filterHeaders($headers)[1]; $this->assertHeaders($headers); $this->headers = $headers; } diff --git a/typo3/sysext/core/Classes/Localization/LanguageStore.php b/typo3/sysext/core/Classes/Localization/LanguageStore.php index 85f535e2cc23..478dfc27c402 100644 --- a/typo3/sysext/core/Classes/Localization/LanguageStore.php +++ b/typo3/sysext/core/Classes/Localization/LanguageStore.php @@ -157,7 +157,7 @@ class LanguageStore implements \TYPO3\CMS\Core\SingletonInterface ]; $fileWithoutExtension = GeneralUtility::getFileAbsFileName($this->getFileReferenceWithoutExtension($fileReference)); foreach ($this->supportedExtensions as $extension) { - if (@is_file(($fileWithoutExtension . '.' . $extension))) { + if (@is_file($fileWithoutExtension . '.' . $extension)) { $this->configuration[$fileReference]['fileReference'] = $fileWithoutExtension . '.' . $extension; $this->configuration[$fileReference]['fileExtension'] = $extension; break; diff --git a/typo3/sysext/core/Classes/Localization/Parser/LocallangXmlParser.php b/typo3/sysext/core/Classes/Localization/Parser/LocallangXmlParser.php index b97cf87b3c14..248a8c914fe6 100644 --- a/typo3/sysext/core/Classes/Localization/Parser/LocallangXmlParser.php +++ b/typo3/sysext/core/Classes/Localization/Parser/LocallangXmlParser.php @@ -42,7 +42,7 @@ class LocallangXmlParser extends AbstractXmlParser { $this->sourcePath = $sourcePath; $this->languageKey = $languageKey; - $this->charset = $this->getCharset($languageKey, $charset); + $this->charset = $this->getCharset($charset); // Parse source $parsedSource = $this->parseXmlFile(); // Parse target diff --git a/typo3/sysext/core/Classes/Package/MetaData/PackageConstraint.php b/typo3/sysext/core/Classes/Package/MetaData/PackageConstraint.php index 49dfa967ed69..9a5a34cc66c7 100644 --- a/typo3/sysext/core/Classes/Package/MetaData/PackageConstraint.php +++ b/typo3/sysext/core/Classes/Package/MetaData/PackageConstraint.php @@ -32,6 +32,18 @@ class PackageConstraint */ protected $value; + /** + * Minimum version for the constraint + * @var string + */ + protected $minVersion; + + /** + * Maximum version for the constraint + * @var string + */ + protected $maxVersion; + /** * Meta data constraint constructor * diff --git a/typo3/sysext/core/Classes/Service/DependencyOrderingService.php b/typo3/sysext/core/Classes/Service/DependencyOrderingService.php index 418ebc2f57dc..62798e3c0f13 100644 --- a/typo3/sysext/core/Classes/Service/DependencyOrderingService.php +++ b/typo3/sysext/core/Classes/Service/DependencyOrderingService.php @@ -83,7 +83,7 @@ class DependencyOrderingService * @param array $dependencies * @param string $beforeKey The key to use in a dependency which specifies the "before"-relation. eg. 'sortBefore', 'loadBefore' * @param string $afterKey The key to use in a dependency which specifies the "after"-relation. eg. 'sortAfter', 'loadAfter' - * @return \bool[][] The dependency graph + * @return bool[][] The dependency graph */ public function buildDependencyGraph(array $dependencies, $beforeKey = 'before', $afterKey = 'after') { diff --git a/typo3/sysext/core/Classes/TimeTracker/TimeTracker.php b/typo3/sysext/core/Classes/TimeTracker/TimeTracker.php index b016595d59d4..38a08c6ba438 100644 --- a/typo3/sysext/core/Classes/TimeTracker/TimeTracker.php +++ b/typo3/sysext/core/Classes/TimeTracker/TimeTracker.php @@ -216,6 +216,7 @@ class TimeTracker implements SingletonInterface } end($this->currentHashPointer); $k = current($this->currentHashPointer); + $placeholder = ''; // Enlarge the "details" column by adding a span if (strlen($content) > 30) { $placeholder = '<br /><span style="width: 300px; height: 1px; display: inline-block;"></span>'; diff --git a/typo3/sysext/core/Classes/TypoScript/ConfigurationForm.php b/typo3/sysext/core/Classes/TypoScript/ConfigurationForm.php index 5c2f209f7a1d..40244d69e022 100644 --- a/typo3/sysext/core/Classes/TypoScript/ConfigurationForm.php +++ b/typo3/sysext/core/Classes/TypoScript/ConfigurationForm.php @@ -77,7 +77,7 @@ class ConfigurationForm extends ExtendedTemplateService { $temp = $this->flatSetup; $this->flatSetup = []; - $this->flattenSetup($valueArray, '', ''); + $this->flattenSetup($valueArray, ''); $this->objReg = $this->ext_realValues = $this->flatSetup; $this->flatSetup = $temp; foreach ($theConstants as $k => $p) { diff --git a/typo3/sysext/core/Classes/Utility/CommandUtility.php b/typo3/sysext/core/Classes/Utility/CommandUtility.php index 1bf8a72db35f..6a4e23b5f279 100644 --- a/typo3/sysext/core/Classes/Utility/CommandUtility.php +++ b/typo3/sysext/core/Classes/Utility/CommandUtility.php @@ -437,6 +437,7 @@ class CommandUtility public static function escapeShellArguments(array $input) { $isUTF8Filesystem = !empty($GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem']); + $currentLocale = false; if ($isUTF8Filesystem) { $currentLocale = setlocale(LC_CTYPE, 0); setlocale(LC_CTYPE, $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale']); @@ -444,7 +445,7 @@ class CommandUtility $output = array_map('escapeshellarg', $input); - if ($isUTF8Filesystem) { + if ($isUTF8Filesystem && $currentLocale !== false) { setlocale(LC_CTYPE, $currentLocale); } diff --git a/typo3/sysext/core/Classes/Utility/File/ExtendedFileUtility.php b/typo3/sysext/core/Classes/Utility/File/ExtendedFileUtility.php index c44bd9ada1ff..aa839d3f1993 100644 --- a/typo3/sysext/core/Classes/Utility/File/ExtendedFileUtility.php +++ b/typo3/sysext/core/Classes/Utility/File/ExtendedFileUtility.php @@ -912,8 +912,8 @@ class ExtendedFileUtility extends BasicFileUtility return false; } $resultObject = null; + $folderName = $cmds['data']; try { - $folderName = $cmds['data']; $resultObject = $targetFolderObject->createFolder($folderName); $this->writeLog(6, 0, 1, 'Directory "%s" created in "%s"', [$folderName, $targetFolderObject->getIdentifier()]); $this->addMessageToFlashMessageQueue('FileUtility.DirectoryCreatedIn', [$folderName, $targetFolderObject->getIdentifier()], FlashMessage::OK); diff --git a/typo3/sysext/core/Classes/Utility/GeneralUtility.php b/typo3/sysext/core/Classes/Utility/GeneralUtility.php index 9956f8e7bc17..5d8eb7cba8c5 100644 --- a/typo3/sysext/core/Classes/Utility/GeneralUtility.php +++ b/typo3/sysext/core/Classes/Utility/GeneralUtility.php @@ -2413,6 +2413,7 @@ class GeneralUtility */ public static function get_dirs($path) { + $dirs = null; if ($path) { if (is_dir($path)) { $dir = scandir($path); @@ -2946,7 +2947,6 @@ class GeneralUtility case 'REMOTE_HOST': case 'QUERY_STRING': - $retVal = ''; if (isset($_SERVER[$getEnvName])) { $retVal = $_SERVER[$getEnvName]; } @@ -2969,9 +2969,8 @@ class GeneralUtility } $commonEnd = strrev(implode('/', $acc)); if ((string)$commonEnd !== '') { - $DR = substr($SFN, 0, -(strlen($commonEnd) + 1)); + $retVal = substr($SFN, 0, -(strlen($commonEnd) + 1)); } - $retVal = $DR; break; case 'TYPO3_HOST_ONLY': $httpHost = self::getIndpEnv('HTTP_HOST'); diff --git a/typo3/sysext/core/Tests/Unit/Http/UploadedFileTest.php b/typo3/sysext/core/Tests/Unit/Http/UploadedFileTest.php index 5643e6e86673..1fa03122b6e0 100644 --- a/typo3/sysext/core/Tests/Unit/Http/UploadedFileTest.php +++ b/typo3/sysext/core/Tests/Unit/Http/UploadedFileTest.php @@ -29,7 +29,7 @@ class UploadedFileTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase protected function setUp() { - $this->tmpfile = null; + $this->tmpFile = null; } protected function tearDown() diff --git a/typo3/sysext/core/Tests/Unit/Resource/FolderTest.php b/typo3/sysext/core/Tests/Unit/Resource/FolderTest.php index 6b27197aea03..aa8776223a86 100644 --- a/typo3/sysext/core/Tests/Unit/Resource/FolderTest.php +++ b/typo3/sysext/core/Tests/Unit/Resource/FolderTest.php @@ -45,7 +45,7 @@ class FolderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase if ($mockedStorage === null) { $mockedStorage = $this->createMock(\TYPO3\CMS\Core\Resource\ResourceStorage::class); } - return new \TYPO3\CMS\Core\Resource\Folder($mockedStorage, $path, $name, 0); + return new \TYPO3\CMS\Core\Resource\Folder($mockedStorage, $path, $name); } /** diff --git a/typo3/sysext/core/Tests/Unit/Utility/ArrayUtilityTest.php b/typo3/sysext/core/Tests/Unit/Utility/ArrayUtilityTest.php index 21f9665767ad..1b28a30d6197 100644 --- a/typo3/sysext/core/Tests/Unit/Utility/ArrayUtilityTest.php +++ b/typo3/sysext/core/Tests/Unit/Utility/ArrayUtilityTest.php @@ -2509,7 +2509,7 @@ class ArrayUtilityTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase 'stan', ]; - $this->assertNull(ArrayUtility::assertAllArrayKeysAreValid($arrayToTest, $allowedArrayKeys)); + ArrayUtility::assertAllArrayKeysAreValid($arrayToTest, $allowedArrayKeys); } /** -- GitLab