diff --git a/Build/gitlab-ci/nightly/integrity.yml b/Build/gitlab-ci/nightly/integrity.yml index d957bf165994c600e027e31d66d1f0922729851c..e8c1b8059d92d70c7b0dcba5e66d2a0117e2a117 100644 --- a/Build/gitlab-ci/nightly/integrity.yml +++ b/Build/gitlab-ci/nightly/integrity.yml @@ -97,14 +97,3 @@ phpstan php 7.4: script: - Build/Scripts/runTests.sh -s composerInstall -p 7.4 - Build/Scripts/runTests.sh -s phpstan -p 7.4 -phpstan php 8.0: - stage: integrity - only: - - schedules - cache: - key: master-composer-phpstan-80 - paths: - - .cache - script: - - Build/Scripts/runTests.sh -s composerInstall -p 8.0 - - Build/Scripts/runTests.sh -s phpstan -p 8.0 diff --git a/Build/gitlab-ci/pre-merge/integrity.yml b/Build/gitlab-ci/pre-merge/integrity.yml index 451512c5ae395e9d9032d6129c36cb1ed3e91627..aefbfdbdf82532a4e09895536740c68a2f775c81 100644 --- a/Build/gitlab-ci/pre-merge/integrity.yml +++ b/Build/gitlab-ci/pre-merge/integrity.yml @@ -98,16 +98,4 @@ phpstan php 7.4 pre-merge: script: - Build/Scripts/runTests.sh -s composerInstall -p 7.4 - Build/Scripts/runTests.sh -s phpstan -p 7.4 -phpstan php 8.0 pre-merge: - stage: main - except: - refs: - - schedules - - master - cache: - key: master-composer-phpstan-80 - paths: - - .cache - script: - - Build/Scripts/runTests.sh -s composerInstall -p 8.0 - - Build/Scripts/runTests.sh -s phpstan -p 8.0 + diff --git a/Build/phpstan.level5.neon b/Build/phpstan.level5.neon index 5c3636c345575f30527b5a3d472b3fa5c2e69765..71105f2edcd010c2fd915c09dd005c0bca4c3a88 100644 --- a/Build/phpstan.level5.neon +++ b/Build/phpstan.level5.neon @@ -5,8 +5,8 @@ conditionalTags: PHPStan\Rules\Functions\RandomIntParametersRule: phpstan.rules.rule: %featureToggles.randomIntParameters% -#parameters: -# checkFunctionArgumentTypes: true +parameters: + checkFunctionArgumentTypes: true # checkArgumentsPassedByReference: true services: diff --git a/phpstan.neon b/phpstan.neon index 5cd6a9307c8d1f731c708077a8046d3fe2389747..b6bf8f19c59c0caace76a09696c53e5cb137a8d9 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -37,6 +37,7 @@ parameters: ignoreErrors: # PHP8 compatibility, as phpstan cannot detect this yet. - "#Class GdImage not found.#" + - "#^Parameter \\#1 \\$disable of function libxml_disable_entity_loader expects bool, bool\\|null given\\.$#" # ignored errors for level 0 - '#Variable \$_EXTKEY might not be defined\.#' @@ -261,3 +262,318 @@ parameters: message: "#^Parameter \\#1 \\$constraint of static method TYPO3\\\\CMS\\\\Core\\\\Database\\\\Query\\\\QueryHelper\\:\\:stripLogicalOperatorPrefix\\(\\) expects string, string\\|null given\\.$#" count: 1 path: typo3/sysext/core/Classes/Database/QueryView.php + + - + message: "#^Parameter \\#1 \\$im of function imagesavealpha expects resource, resource\\|false given\\.$#" + count: 3 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#1 \\$im of function imagecolorallocatealpha expects resource, resource\\|false given\\.$#" + count: 2 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#1 \\$im of function imagefill expects resource, resource\\|false given\\.$#" + count: 2 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#4 \\$col of function imagefill expects int, int\\|false given\\.$#" + count: 2 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#1 \\$im of function imagecolorallocate expects resource, resource\\|false given\\.$#" + count: 11 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#1 \\$im of function imagefilledrectangle expects resource, resource\\|false given\\.$#" + count: 11 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#6 \\$col of function imagefilledrectangle expects int, int\\|false given\\.$#" + count: 12 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#1 \\$dst_im of function imagecopyresized expects resource, resource\\|false given\\.$#" + count: 2 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#6 \\$Fcolor of method TYPO3\\\\CMS\\\\Core\\\\Imaging\\\\GraphicalFunctions\\:\\:SpacedImageTTFText\\(\\) expects int, int\\|false given\\.$#" + count: 2 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#6 \\$color of method TYPO3\\\\CMS\\\\Core\\\\Imaging\\\\GraphicalFunctions\\:\\:renderTTFText\\(\\) expects int, int\\|false given\\.$#" + count: 2 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#1 \\$destImg of method TYPO3\\\\CMS\\\\Core\\\\Imaging\\\\GraphicalFunctions\\:\\:ImageWrite\\(\\) expects resource, resource\\|false given\\.$#" + count: 2 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#1 \\$im of function imagedestroy expects resource, resource\\|false given\\.$#" + count: 3 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#6 \\$col of function imagettftext expects int, int\\|false given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#6 \\$color of function imagefilledellipse expects int, int\\|false given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#4 \\$green of function imagecolorset expects int, float given\\.$#" + count: 2 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#5 \\$blue of function imagecolorset expects int, float given\\.$#" + count: 2 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#1 \\$im of function imagegif expects resource, resource\\|false given\\.$#" + count: 2 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#1 \\$im of function imagestring expects resource, resource\\|false given\\.$#" + count: 3 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#6 \\$col of function imagestring expects int, int\\|false given\\.$#" + count: 3 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#1 \\$im of function imagepng expects resource, resource\\|false given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php + + - + message: "#^Parameter \\#2 \\$id of method TYPO3\\\\CMS\\\\Core\\\\DataHandling\\\\DataHandler\\:\\:getRecordProperties\\(\\) expects int, int\\|string given\\.$#" + count: 2 + path: typo3/sysext/core/Classes/DataHandling/DataHandler.php + + - + message: "#^Parameter \\#5 \\$id of method TYPO3\\\\CMS\\\\Core\\\\DataHandling\\\\DataHandler\\:\\:checkValue_SW\\(\\) expects int, int\\|string given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/DataHandling/DataHandler.php + + - + message: "#^Parameter \\#1 \\$function of function call_user_func_array expects callable\\(\\)\\: mixed, array\\(\\$this\\(TYPO3\\\\CMS\\\\Core\\\\DataHandling\\\\DataHandler\\), mixed\\) given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/DataHandling/DataHandler.php + + - + message: "#^Parameter \\#1 \\$im of function imagecolorallocate expects resource, resource\\|false given\\.$#" + count: 6 + path: typo3/sysext/install/Classes/Controller/EnvironmentController.php + + - + message: "#^Parameter \\#1 \\$im of function imagettftext expects resource, resource\\|false given\\.$#" + count: 1 + path: typo3/sysext/install/Classes/Controller/EnvironmentController.php + + - + message: "#^Parameter \\#6 \\$col of function imagettftext expects int, int\\|false given\\.$#" + count: 1 + path: typo3/sysext/install/Classes/Controller/EnvironmentController.php + + - + message: "#^Parameter \\#1 \\$im of function imagegif expects resource, resource\\|false given\\.$#" + count: 1 + path: typo3/sysext/install/Classes/Controller/EnvironmentController.php + + - + message: "#^Parameter \\#1 \\$im of function imagefilledrectangle expects resource, resource\\|false given\\.$#" + count: 4 + path: typo3/sysext/install/Classes/Controller/EnvironmentController.php + + - + message: "#^Parameter \\#6 \\$col of function imagefilledrectangle expects int, int\\|false given\\.$#" + count: 4 + path: typo3/sysext/install/Classes/Controller/EnvironmentController.php + + - + message: "#^Parameter \\#1 \\$im of function imagedestroy expects resource, resource\\|false given\\.$#" + count: 3 + path: typo3/sysext/install/Classes/SystemEnvironment/Check.php + + - + message: "#^Parameter \\#1 \\$stageRecord of method TYPO3\\\\CMS\\\\Workspaces\\\\Controller\\\\Remote\\\\ActionHandler\\:\\:getRecipientsOfStage\\(\\) expects int\\|TYPO3\\\\CMS\\\\Workspaces\\\\Domain\\\\Record\\\\StageRecord, TYPO3\\\\CMS\\\\Workspaces\\\\Domain\\\\Record\\\\StageRecord\\|null given\\.$#" + count: 1 + path: typo3/sysext/workspaces/Classes/Controller/Remote/ActionHandler.php + + - + message: "#^Parameter \\#2 \\$now of function strtotime expects int, int\\|false given\\.$#" + count: 1 + path: typo3/sysext/scheduler/Classes/CronCommand/NormalizeCommand.php + + - + message: "#^Parameter \\#1 \\$name of function setcookie expects string, string\\|false given\\.$#" + count: 1 + path: typo3/sysext/install/Classes/Service/SessionService.php + + - + message: "#^Unable to resolve the template type T in call to method static method Doctrine\\\\DBAL\\\\DriverManager\\:\\:getConnection\\(\\)$#" + count: 4 + path: typo3/sysext/install/Classes/Controller/InstallerController.php + + - + message: "#^Parameter \\#1 \\$params of static method Doctrine\\\\DBAL\\\\DriverManager\\:\\:getConnection\\(\\) expects array\\(\\?'wrapperClass' \\=\\> class\\-string\\<Doctrine\\\\DBAL\\\\Connection\\>\\), array\\<string, string\\>&nonEmpty given\\.$#" + count: 1 + path: typo3/sysext/install/Classes/Controller/InstallerController.php + + - + message: "#^Parameter \\#4 \\$col of function imagefill expects int, int\\|false given\\.$#" + count: 1 + path: typo3/sysext/frontend/Classes/Imaging/GifBuilder.php + + - + message: "#^Parameter \\#6 \\$col of function imagefilledrectangle expects int, int\\|false given\\.$#" + count: 1 + path: typo3/sysext/frontend/Classes/Imaging/GifBuilder.php + + - + message: "#^Parameter \\#2 \\$col of function imagecolortransparent expects int, int\\|false given\\.$#" + count: 1 + path: typo3/sysext/frontend/Classes/Imaging/GifBuilder.php + + - + message: "#^Parameter \\#1 \\$node of function dom_import_simplexml expects SimpleXMLElement, SimpleXMLElement\\|false given\\.$#" + count: 1 + path: typo3/sysext/frontend/Classes/ContentObject/ScalableVectorGraphicsContentObject.php + + - + message: "#^Parameter \\#1 \\$array_arg of function current expects array, object given\\.$#" + count: 1 + path: typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php + + - + message: "#^Parameter \\#1 \\$array_arg of function key expects array, object given\\.$#" + count: 1 + path: typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php + + - + message: "#^Parameter \\#1 \\$array_arg of function next expects array, object given\\.$#" + count: 1 + path: typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php + + - + message: "#^Parameter \\#1 \\$array of function reset expects array, object given\\.$#" + count: 1 + path: typo3/sysext/extbase/Classes/Persistence/Generic/LazyLoadingProxy.php + + - + message: "#^Parameter \\#1 \\$currentRequest of static method TYPO3\\\\CMS\\\\Extbase\\\\Mvc\\\\Dispatcher\\:\\:buildRequestFromCurrentRequestAndForwardResponse\\(\\) expects TYPO3\\\\CMS\\\\Extbase\\\\Mvc\\\\Request, TYPO3\\\\CMS\\\\Extbase\\\\Mvc\\\\RequestInterface given\\.$#" + count: 1 + path: typo3/sysext/extbase/Classes/Mvc/Dispatcher.php + + - + message: "#^Parameter \\#1 \\$node of method TYPO3\\\\CMS\\\\Core\\\\Tree\\\\TableConfiguration\\\\ArrayTreeRenderer\\:\\:renderNode\\(\\) expects TYPO3\\\\CMS\\\\Backend\\\\Tree\\\\TreeRepresentationNode, TYPO3\\\\CMS\\\\Backend\\\\Tree\\\\TreeNode given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/Tree/TableConfiguration/ArrayTreeRenderer.php + + - + message: "#^Parameter \\#2 \\$folder of method TYPO3\\\\CMS\\\\Core\\\\Resource\\\\ResourceStorage\\:\\:checkFolderActionPermission\\(\\) expects TYPO3\\\\CMS\\\\Core\\\\Resource\\\\Folder\\|null, TYPO3\\\\CMS\\\\Core\\\\Resource\\\\FolderInterface given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/Resource/ResourceStorage.php + + - + message: "#^Parameter \\#1 \\$file of class TYPO3\\\\CMS\\\\Core\\\\Resource\\\\Event\\\\AfterFileAddedEvent constructor expects TYPO3\\\\CMS\\\\Core\\\\Resource\\\\FileInterface, TYPO3\\\\CMS\\\\Core\\\\Resource\\\\File\\|TYPO3\\\\CMS\\\\Core\\\\Resource\\\\ProcessedFile\\|null given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/Resource/ResourceStorage.php + + - + message: "#^Parameter \\#1 \\$file of method TYPO3\\\\CMS\\\\Core\\\\Resource\\\\ResourceStorage\\:\\:replaceFile\\(\\) expects TYPO3\\\\CMS\\\\Core\\\\Resource\\\\FileInterface, TYPO3\\\\CMS\\\\Core\\\\Resource\\\\File\\|TYPO3\\\\CMS\\\\Core\\\\Resource\\\\ProcessedFile\\|null given\\.$#" + count: 2 + path: typo3/sysext/core/Classes/Resource/ResourceStorage.php + + - + message: "#^Parameter \\#1 \\$folder of method TYPO3\\\\CMS\\\\Core\\\\Resource\\\\ResourceStorage\\:\\:isWithinFolder\\(\\) expects TYPO3\\\\CMS\\\\Core\\\\Resource\\\\Folder, TYPO3\\\\CMS\\\\Core\\\\Resource\\\\FolderInterface given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/Resource/ResourceStorage.php + + - + message: "#^Parameter \\#1 \\$address of method TYPO3\\\\CMS\\\\Core\\\\Mail\\\\Rfc822AddressesParser\\:\\:_splitAddresses\\(\\) expects string, string\\|true given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/Mail/Rfc822AddressesParser.php + + - + message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|null given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/Http/Stream.php + + - + message: "#^Parameter \\#1 \\$exception_handler of function set_exception_handler expects \\(callable\\(Throwable\\)\\: void\\)\\|null, array\\(\\$this\\(TYPO3\\\\CMS\\\\Core\\\\Error\\\\ProductionExceptionHandler\\), 'handleException'\\) given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/Error/ProductionExceptionHandler.php + + - + message: "#^Parameter \\#1 \\$exception_handler of function set_exception_handler expects \\(callable\\(Throwable\\)\\: void\\)\\|null, array\\(\\$this\\(TYPO3\\\\CMS\\\\Core\\\\Error\\\\DebugExceptionHandler\\), 'handleException'\\) given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/Error/DebugExceptionHandler.php + + - + message: "#^Parameter \\#2 \\$package of method TYPO3\\\\CMS\\\\Core\\\\DependencyInjection\\\\ServiceProviderRegistry\\:\\:create\\(\\) expects TYPO3\\\\CMS\\\\Core\\\\Package\\\\Package\\|null, TYPO3\\\\CMS\\\\Core\\\\Package\\\\PackageInterface given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/DependencyInjection/ServiceProviderRegistry.php + + - + message: "#^Parameter \\#1 \\$name of class ReflectionFunction constructor expects Closure\\|string, callable\\(\\)\\: mixed given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/DependencyInjection/ServiceProviderCompilationPass.php + + - + message: "#^Unable to resolve the template type T in call to method static method Doctrine\\\\DBAL\\\\DriverManager\\:\\:getConnection\\(\\)$#" + count: 1 + path: typo3/sysext/core/Classes/Database/ConnectionPool.php + + - + message: "#^Parameter \\#2 \\$algo of function password_hash expects string\\|null, int\\|string\\|null given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/Crypto/PasswordHashing/AbstractArgon2PasswordHash.php + + - + message: "#^Parameter \\#2 \\$algo of function password_needs_rehash expects string\\|null, int\\|string\\|null given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/Crypto/PasswordHashing/AbstractArgon2PasswordHash.php + + - + message: "#^Parameter \\#1 \\$manifest of method TYPO3\\\\CMS\\\\Core\\\\Core\\\\ClassLoadingInformationGenerator\\:\\:getAutoloadSectionFromManifest\\(\\) expects stdClass, object given\\.$#" + count: 2 + path: typo3/sysext/core/Classes/Core/ClassLoadingInformationGenerator.php + + - + message: "#^Parameter \\#1 \\$file of method TYPO3\\\\CMS\\\\Core\\\\Controller\\\\FileDumpController\\:\\:isFileValid\\(\\) expects TYPO3\\\\CMS\\\\Core\\\\Resource\\\\FileInterface, TYPO3\\\\CMS\\\\Core\\\\Resource\\\\File\\|null given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/Controller/FileDumpController.php + + - + message: "#^Parameter \\#2 \\$callback of function array_walk expects callable\\(\\)\\: mixed, array\\(\\$this\\(TYPO3\\\\CMS\\\\Core\\\\Cache\\\\Backend\\\\AbstractBackend\\), 'flushByTag'\\) given\\.$#" + count: 1 + path: typo3/sysext/core/Classes/Cache/Backend/AbstractBackend.php + + - + message: "#^Parameter \\#1 \\$node of method TYPO3\\\\CMS\\\\Backend\\\\Tree\\\\Renderer\\\\UnorderedListTreeRenderer\\:\\:renderNode\\(\\) expects TYPO3\\\\CMS\\\\Backend\\\\Tree\\\\TreeRepresentationNode, TYPO3\\\\CMS\\\\Backend\\\\Tree\\\\TreeNode given\\.$#" + count: 1 + path: typo3/sysext/backend/Classes/Tree/Renderer/UnorderedListTreeRenderer.php + + - + message: "#^Parameter \\#1 \\$result of method TYPO3\\\\CMS\\\\Backend\\\\Controller\\\\File\\\\FileController\\:\\:flattenResultDataValue\\(\\) expects bool\\|TYPO3\\\\CMS\\\\Core\\\\Resource\\\\File\\|TYPO3\\\\CMS\\\\Core\\\\Resource\\\\Folder, TYPO3\\\\CMS\\\\Core\\\\Resource\\\\File\\|TYPO3\\\\CMS\\\\Core\\\\Resource\\\\ProcessedFile given\\.$#" + count: 1 + path: typo3/sysext/backend/Classes/Controller/File/FileController.php \ No newline at end of file diff --git a/typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php b/typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php index 12e59c03eacad16ae23d038103a5779e0b9b1086..06a94e354cf2cfe8dcab99653633d46509b462a3 100644 --- a/typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php +++ b/typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php @@ -311,7 +311,7 @@ class ElementInformationController } else { $rendererRegistry = GeneralUtility::makeInstance(RendererRegistry::class); $fileRenderer = $rendererRegistry->getRenderer($this->fileObject); - $preview['url'] = PathUtility::getAbsoluteWebPath($this->fileObject->getPublicUrl()); + $preview['url'] = PathUtility::getAbsoluteWebPath($this->fileObject->getPublicUrl() ?? ''); $width = '590m'; $height = '400m'; diff --git a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php index 2df67d9013f3ffd8a99c285287dd995a8c9840d9..94afe4b93e529db915f2f29a4c64b069b24bbec0 100644 --- a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php +++ b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php @@ -2511,7 +2511,7 @@ class EditDocumentController } if ($action === 'edit') { - $record = BackendUtility::getRecord($table, $recordId); + $record = BackendUtility::getRecord($table, $recordId) ?? []; $recordTitle = BackendUtility::getRecordTitle($table, $record) ?? ''; if ($table === 'pages') { return sprintf($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.editPage'), $tableTitle, $recordTitle); @@ -2523,7 +2523,7 @@ class EditDocumentController if ($pageId === 0) { return sprintf($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.editRecordRootLevel'), $tableTitle, $recordTitle); } - $pageRow = BackendUtility::getRecord('pages', $pageId); + $pageRow = BackendUtility::getRecord('pages', $pageId) ?? []; $pageTitle = BackendUtility::getRecordTitle('pages', $pageRow); if ($recordTitle !== '') { return sprintf($languageService->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.editRecord'), $tableTitle, $recordTitle, $pageTitle); diff --git a/typo3/sysext/backend/Classes/Controller/File/FileController.php b/typo3/sysext/backend/Classes/Controller/File/FileController.php index 9a2948ff66061bee826855f1dee217465b851d4d..e7a6933041bcade6bac72681794b865ddfc597d8 100644 --- a/typo3/sysext/backend/Classes/Controller/File/FileController.php +++ b/typo3/sysext/backend/Classes/Controller/File/FileController.php @@ -192,7 +192,12 @@ class FileController $result = []; if ($fileTargetObject->hasFile($processedFileName)) { - $result = $this->flattenResultDataValue($fileTargetObject->getStorage()->getFileInFolder($processedFileName, $fileTargetObject)); + $fileInFolder = $fileTargetObject->getStorage()->getFileInFolder($processedFileName, $fileTargetObject); + if ($fileInFolder === null) { + $result = []; + } else { + $result = $this->flattenResultDataValue($fileInFolder); + } } return (new JsonResponse())->setPayload($result); } @@ -306,7 +311,7 @@ class FileController if ($result->isImage()) { $processedFile = $result->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, []); if ($processedFile) { - $thumbUrl = PathUtility::getAbsoluteWebPath($processedFile->getPublicUrl()); + $thumbUrl = PathUtility::getAbsoluteWebPath($processedFile->getPublicUrl() ?? ''); } } $iconFactory = GeneralUtility::makeInstance(IconFactory::class); diff --git a/typo3/sysext/backend/Classes/Controller/File/ImageProcessController.php b/typo3/sysext/backend/Classes/Controller/File/ImageProcessController.php index d08e887686d51dcc8f71b629b07050b3105da643..73bc5bbb9fd46e2c34c9976b5f409e6d30a84f39 100644 --- a/typo3/sysext/backend/Classes/Controller/File/ImageProcessController.php +++ b/typo3/sysext/backend/Classes/Controller/File/ImageProcessController.php @@ -54,7 +54,7 @@ class ImageProcessController implements LoggerAwareInterface $processedFile = $this->imageProcessingService->process($processedFileId); return new RedirectResponse( - GeneralUtility::locationHeaderUrl($processedFile->getPublicUrl(true)) + GeneralUtility::locationHeaderUrl($processedFile->getPublicUrl(true) ?? '') ); } catch (\Throwable $e) { // Fatal error occurred, which will be responded as 404 diff --git a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php index c1fb4592df518dd1c83059c9fafd02d99b963023..26a6b685c70cdd3e263eb4da310b0d742624fc0a 100644 --- a/typo3/sysext/backend/Classes/Controller/PageLayoutController.php +++ b/typo3/sysext/backend/Classes/Controller/PageLayoutController.php @@ -1114,7 +1114,7 @@ class PageLayoutController return sprintf( '%s: %s [%d]', $this->getLanguageService()->sL('LLL:EXT:backend/Resources/Private/Language/locallang_mod.xlf:mlang_labels_tablabel'), - BackendUtility::getRecordTitle('pages', $this->pageinfo), + BackendUtility::getRecordTitle('pages', (array)$this->pageinfo), $this->id ); } diff --git a/typo3/sysext/backend/Classes/Controller/Wizard/TableController.php b/typo3/sysext/backend/Classes/Controller/Wizard/TableController.php index b8c6873b05f4264afd0b3196519829ba759f7d4b..424af1bfdd8f39581a3f165675f548e8441c5423 100644 --- a/typo3/sysext/backend/Classes/Controller/Wizard/TableController.php +++ b/typo3/sysext/backend/Classes/Controller/Wizard/TableController.php @@ -336,7 +336,7 @@ class TableController extends AbstractWizardController GeneralUtility::implodeAttributes([ 'id' => 'typo3-tablewizard', 'type' => $this->inputStyle ? 'input' : 'textarea', - 'append-rows' => $this->numNewRows, + 'append-rows' => (string)$this->numNewRows, 'table' => GeneralUtility::jsonEncodeForHtmlAttribute($configuration, false), ], true) ); diff --git a/typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php b/typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php index f2de7c40d7801d65a633f4fe9611aa489a82d293..03d3449f43c2d02b2e94c6330a3c1a01dda7e07d 100644 --- a/typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php +++ b/typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php @@ -388,7 +388,7 @@ class InlineRecordContainer extends AbstractContainer $processedImage = $fileObject->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $imageSetup); // Only use a thumbnail if the processing process was successful by checking if image width is set if ($processedImage->getProperty('width')) { - $imageUrl = $processedImage->getPublicUrl(); + $imageUrl = $processedImage->getPublicUrl() ?? ''; $thumbnail = '<img src="' . PathUtility::getAbsoluteWebPath($imageUrl) . '" ' . 'width="' . $processedImage->getProperty('width') . '" ' . 'height="' . $processedImage->getProperty('height') . '" ' . diff --git a/typo3/sysext/backend/Classes/Form/Element/FileInfoElement.php b/typo3/sysext/backend/Classes/Form/Element/FileInfoElement.php index 7d019c9a97ad3f733f2507aadb2c4c4529ae8d16..f30c6dbfc0c3ab10694449f86ff68b027b0e0b9d 100644 --- a/typo3/sysext/backend/Classes/Form/Element/FileInfoElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/FileInfoElement.php @@ -89,7 +89,7 @@ class FileInfoElement extends AbstractFormElement $content .= ' (' . htmlspecialchars(GeneralUtility::formatSize((int)$file->getSize())) . 'bytes)<br />'; $content .= BackendUtility::getProcessedValue('sys_file', 'type', (string)$file->getType()) . ' (' . $file->getMimeType() . ')<br />'; $content .= htmlspecialchars($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:fileMetaDataLocation')) . ': '; - $content .= '<a href="' . htmlspecialchars(PathUtility::getAbsoluteWebPath($file->getPublicUrl())) . '" target="_blank" title="' . $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.view') . '">' . htmlspecialchars($file->getStorage()->getName()) . ' - ' . htmlspecialchars($file->getIdentifier()) . '</a><br />'; + $content .= '<a href="' . htmlspecialchars(PathUtility::getAbsoluteWebPath($file->getPublicUrl() ?? '')) . '" target="_blank" title="' . $this->getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:cm.view') . '">' . htmlspecialchars($file->getStorage()->getName()) . ' - ' . htmlspecialchars($file->getIdentifier()) . '</a><br />'; $content .= '<br />'; } else { $content = '<h2>' . htmlspecialchars($lang->sL('LLL:EXT:core/Resources/Private/Language/locallang_misc.xlf:fileMetaErrorInvalidRecord')) . '</h2>'; diff --git a/typo3/sysext/backend/Classes/Template/Components/ButtonBar.php b/typo3/sysext/backend/Classes/Template/Components/ButtonBar.php index 9f035bb8c034afc49dadc0c1f2a58db9458beabb..cca148836704c803622c2d48cbb3dd5d65376f1a 100644 --- a/typo3/sysext/backend/Classes/Template/Components/ButtonBar.php +++ b/typo3/sysext/backend/Classes/Template/Components/ButtonBar.php @@ -88,7 +88,7 @@ class ButtonBar */ public function makeButton($button) { - if (!in_array(ButtonInterface::class, class_implements($button), true)) { + if (!in_array(ButtonInterface::class, class_implements($button) ?: [], true)) { throw new \InvalidArgumentException('A Button must implement ButtonInterface', 1441706378); } return GeneralUtility::makeInstance($button); diff --git a/typo3/sysext/backend/Classes/Template/Components/Buttons/Action/ShortcutButton.php b/typo3/sysext/backend/Classes/Template/Components/Buttons/Action/ShortcutButton.php index 9cb2197640761f7ceb2f7135f7e6b8592d1bb1a7..1fb67f70506cfca3d7448428467beff75c65d118 100644 --- a/typo3/sysext/backend/Classes/Template/Components/Buttons/Action/ShortcutButton.php +++ b/typo3/sysext/backend/Classes/Template/Components/Buttons/Action/ShortcutButton.php @@ -326,7 +326,7 @@ class ShortcutButton implements ButtonInterface, PositionInterface unset($arguments['returnUrl']); // Encode arguments to be stored in the database - $arguments = json_encode($arguments); + $arguments = json_encode($arguments) ?: ''; if (GeneralUtility::makeInstance(ShortcutRepository::class)->shortcutExists($routeIdentifier, $arguments)) { return '<a class="active btn btn-default btn-sm" title="">' diff --git a/typo3/sysext/backend/Classes/Utility/BackendUtility.php b/typo3/sysext/backend/Classes/Utility/BackendUtility.php index 8773731d18e1d6367861ff140990928fbb3eeb9f..0b35a3d07028c9d727495497af49af40d0d82a86 100644 --- a/typo3/sysext/backend/Classes/Utility/BackendUtility.php +++ b/typo3/sysext/backend/Classes/Utility/BackendUtility.php @@ -1061,7 +1061,7 @@ class BackendUtility } $processedImage = $fileObject->process($taskType, $processingConfiguration); $attributes = [ - 'src' => PathUtility::getAbsoluteWebPath($processedImage->getPublicUrl()), + 'src' => PathUtility::getAbsoluteWebPath($processedImage->getPublicUrl() ?? ''), 'width' => $processedImage->getProperty('width'), 'height' => $processedImage->getProperty('height'), 'alt' => $fileReferenceObject->getName(), diff --git a/typo3/sysext/belog/Classes/Controller/BackendLogController.php b/typo3/sysext/belog/Classes/Controller/BackendLogController.php index 08ffeb2d59d93c5525ce784dd0e672a84405293e..cbfa7b1380e5ea7abd42ebb6cc9182069bb8ab20 100644 --- a/typo3/sysext/belog/Classes/Controller/BackendLogController.php +++ b/typo3/sysext/belog/Classes/Controller/BackendLogController.php @@ -227,7 +227,7 @@ class BackendLogController extends ActionController $targetStructure[$pid] = []; } // Get day timestamp of log entry and create sub array if needed - $timestampDay = strtotime(strftime('%d.%m.%Y', $entry->getTstamp())); + $timestampDay = strtotime(strftime('%d.%m.%Y', $entry->getTstamp()) ?: ''); if (!is_array($targetStructure[$pid][$timestampDay])) { $targetStructure[$pid][$timestampDay] = []; } diff --git a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php index d769c22d5c22763777c627818d8b769b990e31d3..5cb97907446f727d0018223d5cff499e8705192a 100644 --- a/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php +++ b/typo3/sysext/core/Classes/Authentication/AbstractUserAuthentication.php @@ -823,7 +823,7 @@ abstract class AbstractUserAuthentication implements LoggerAwareInterface return null; } // Fetch the user from the DB - $userRecord = $this->getRawUserByUid($this->userSession->getUserId()); + $userRecord = $this->getRawUserByUid($this->userSession->getUserId() ?? 0); if ($userRecord) { // A user was found $userRecord['is_online'] = $this->userSession->getLastUpdated(); diff --git a/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php b/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php index c4b63ce09f0dc8672c258740f1d6618e81b754e9..d089bbd1b2d17d39d0b14d57105f4c4cc9c32497 100644 --- a/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php +++ b/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php @@ -1891,7 +1891,7 @@ TCAdefaults.sys_note.email = ' . $this->user['email']; $workspaceWebMounts = GeneralUtility::intExplode(',', $dbMountpoints); $webMountsOfUser = GeneralUtility::intExplode(',', $this->groupData['webmounts']); - $webMountsOfUser = array_combine($webMountsOfUser, $webMountsOfUser); + $webMountsOfUser = array_combine($webMountsOfUser, $webMountsOfUser) ?: []; $entryPointRootLineUids = []; foreach ($webMountsOfUser as $webMountPageId) { diff --git a/typo3/sysext/core/Classes/Authentication/Mfa/Provider/RecoveryCodesProvider.php b/typo3/sysext/core/Classes/Authentication/Mfa/Provider/RecoveryCodesProvider.php index a3b0c61876a939560a18f283a24c7e52b7fc2ac3..ed3b9ecc49cdc3648bd2a4d61a44ac169355b55c 100644 --- a/typo3/sysext/core/Classes/Authentication/Mfa/Provider/RecoveryCodesProvider.php +++ b/typo3/sysext/core/Classes/Authentication/Mfa/Provider/RecoveryCodesProvider.php @@ -178,7 +178,7 @@ class RecoveryCodesProvider implements MfaProviderInterface $view->assignMultiple([ 'recoveryCodes' => implode(PHP_EOL, $codes), // Generate hmac of the recovery codes to prevent them from being changed in the setup from - 'checksum' => GeneralUtility::hmac(json_encode($codes), 'recovery-codes-setup') + 'checksum' => GeneralUtility::hmac(json_encode($codes) ?: '', 'recovery-codes-setup') ]); break; case MfaViewType::EDIT: @@ -220,7 +220,7 @@ class RecoveryCodesProvider implements MfaProviderInterface $recoveryCodes = GeneralUtility::trimExplode(PHP_EOL, (string)($request->getParsedBody()['recoveryCodes'] ?? '')); $checksum = (string)($request->getParsedBody()['checksum'] ?? ''); if ($recoveryCodes === [] - || !hash_equals(GeneralUtility::hmac(json_encode($recoveryCodes), 'recovery-codes-setup'), $checksum) + || !hash_equals(GeneralUtility::hmac(json_encode($recoveryCodes) ?: '', 'recovery-codes-setup'), $checksum) ) { // Return since the request does not contain the initially created recovery codes return false; diff --git a/typo3/sysext/core/Classes/Charset/CharsetConverter.php b/typo3/sysext/core/Classes/Charset/CharsetConverter.php index 6e3749eb67f06885c9c413b7f0b03e62a989b439..92b847b2c772c9ff1f521a63d422526f6c5518fa 100644 --- a/typo3/sysext/core/Classes/Charset/CharsetConverter.php +++ b/typo3/sysext/core/Classes/Charset/CharsetConverter.php @@ -399,7 +399,7 @@ class CharsetConverter implements SingletonInterface } else { $int = $ord; } - return $hex ? 'x' . dechex($int) : $int; + return $hex ? 'x' . dechex((int)$int) : $int; } /******************************************** diff --git a/typo3/sysext/core/Classes/Crypto/PasswordHashing/Pbkdf2PasswordHash.php b/typo3/sysext/core/Classes/Crypto/PasswordHashing/Pbkdf2PasswordHash.php index 6da8345dc0a9a652fe575dedcc6b5350aab685b2..d4bf0b5b4657540c2548c51e3f22cc95ffe5c9b7 100644 --- a/typo3/sysext/core/Classes/Crypto/PasswordHashing/Pbkdf2PasswordHash.php +++ b/typo3/sysext/core/Classes/Crypto/PasswordHashing/Pbkdf2PasswordHash.php @@ -205,7 +205,7 @@ class Pbkdf2PasswordHash implements PasswordHashInterface { if (!strncmp('$', $salt, 1)) { if (!strncmp(self::PREFIX, $salt, strlen(self::PREFIX))) { - $saltParts = GeneralUtility::trimExplode('$', $salt, 4); + $saltParts = GeneralUtility::trimExplode('$', $salt, true); $salt = $saltParts[2]; } } diff --git a/typo3/sysext/core/Classes/Database/QueryGenerator.php b/typo3/sysext/core/Classes/Database/QueryGenerator.php index 471cf4e34dabe5c6b071b17fd131285a09d156dd..8a0bfc2124ecdba0826cd40c1b743c301285b4f4 100644 --- a/typo3/sysext/core/Classes/Database/QueryGenerator.php +++ b/typo3/sysext/core/Classes/Database/QueryGenerator.php @@ -1525,7 +1525,7 @@ class QueryGenerator $nextButton = ''; if ($limitBegin) { - $prevButton = '<input type="button" class="btn btn-default" value="previous ' . htmlspecialchars($limitLength) . '" data-value="' . htmlspecialchars($prevLimit . ',' . $limitLength) . '">'; + $prevButton = '<input type="button" class="btn btn-default" value="previous ' . htmlspecialchars((string)$limitLength) . '" data-value="' . htmlspecialchars($prevLimit . ',' . $limitLength) . '">'; } if (!$limitLength) { $limitLength = 100; @@ -1536,7 +1536,7 @@ class QueryGenerator $nextLimit = 0; } if ($nextLimit) { - $nextButton = '<input type="button" class="btn btn-default" value="next ' . htmlspecialchars($limitLength) . '" data-value="' . htmlspecialchars($nextLimit . ',' . $limitLength) . '">'; + $nextButton = '<input type="button" class="btn btn-default" value="next ' . htmlspecialchars((string)$limitLength) . '" data-value="' . htmlspecialchars($nextLimit . ',' . $limitLength) . '">'; } $out[] = '<div class="form-group">'; diff --git a/typo3/sysext/core/Classes/ExpressionLanguage/Resolver.php b/typo3/sysext/core/Classes/ExpressionLanguage/Resolver.php index b7a4a881f9fed1abca505b2031fffb2665b603f5..12cdc74a169895d04d6ece41b168d9a5ba76fb7b 100644 --- a/typo3/sysext/core/Classes/ExpressionLanguage/Resolver.php +++ b/typo3/sysext/core/Classes/ExpressionLanguage/Resolver.php @@ -17,6 +17,7 @@ declare(strict_types=1); namespace TYPO3\CMS\Core\ExpressionLanguage; +use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -63,6 +64,7 @@ class Resolver $generalVariables = array_replace_recursive(...$generalVariables); $this->expressionLanguageVariables = array_replace_recursive($generalVariables, $variables); foreach ($functionProviders as $functionProvider) { + /** @var ExpressionFunctionProviderInterface[] $functionProviderInstances */ $functionProviderInstances[] = GeneralUtility::makeInstance($functionProvider); } $this->expressionLanguage = new ExpressionLanguage(null, $functionProviderInstances); diff --git a/typo3/sysext/core/Classes/Html/HtmlParser.php b/typo3/sysext/core/Classes/Html/HtmlParser.php index bb0b268c7cd0e78da715ebd03e8185ab9606e7bb..a35a7b9589cc5718622b03bf83d9e7e02d08497d 100644 --- a/typo3/sysext/core/Classes/Html/HtmlParser.php +++ b/typo3/sysext/core/Classes/Html/HtmlParser.php @@ -274,7 +274,7 @@ class HtmlParser } } else { if ($namekey = preg_replace('/[^[:alnum:]_\\:\\-]/', '', $val) ?? '') { - $name = strtolower($namekey); + $name = strtolower((string)$namekey); $attributesMeta[$name] = []; $attributesMeta[$name]['origTag'] = $namekey; $attributes[$name] = ''; @@ -525,7 +525,7 @@ class HtmlParser $tagAttrib[0][$attr] = $params['list'][0]; } } else { - if (!in_array($this->caseShift($tagAttrib[0][$attr], $params['casesensitiveComp']), $this->caseShift($params['list'], $params['casesensitiveComp'], $tagName))) { + if (!in_array($this->caseShift($tagAttrib[0][$attr], $params['casesensitiveComp']), (array)$this->caseShift($params['list'], $params['casesensitiveComp'], $tagName))) { $tagAttrib[0][$attr] = $params['list'][0]; } } diff --git a/typo3/sysext/core/Classes/Imaging/IconRegistry.php b/typo3/sysext/core/Classes/Imaging/IconRegistry.php index 7a39bc831c7a8145c720251c517dc734e0d82424..1920a60be7099bace36cc24f1543b15023d4f274 100644 --- a/typo3/sysext/core/Classes/Imaging/IconRegistry.php +++ b/typo3/sysext/core/Classes/Imaging/IconRegistry.php @@ -473,7 +473,7 @@ class IconRegistry implements SingletonInterface { $dir = dirname($this->backendIconDeclaration); $absoluteIconDeclarationPath = GeneralUtility::getFileAbsFileName($this->backendIconDeclaration); - $json = json_decode(file_get_contents($absoluteIconDeclarationPath), true); + $json = json_decode(file_get_contents($absoluteIconDeclarationPath) ?: '', true); foreach ($json['icons'] ?? [] as $declaration) { $iconOptions = [ 'sprite' => $dir . '/' . $declaration['sprite'], @@ -536,7 +536,7 @@ class IconRegistry implements SingletonInterface */ public function registerIcon($identifier, $iconProviderClassName, array $options = []) { - if (!in_array(IconProviderInterface::class, class_implements($iconProviderClassName), true)) { + if (!in_array(IconProviderInterface::class, class_implements($iconProviderClassName) ?: [], true)) { throw new \InvalidArgumentException('An IconProvider must implement ' . IconProviderInterface::class, 1437425803); } diff --git a/typo3/sysext/core/Classes/Resource/Collection/FileCollectionRegistry.php b/typo3/sysext/core/Classes/Resource/Collection/FileCollectionRegistry.php index 412a5389e623ce01e4d6ed41c192140f7cf7ea4c..3a4d8040562e9717a3c53b67e8e1c5fc563f636c 100644 --- a/typo3/sysext/core/Classes/Resource/Collection/FileCollectionRegistry.php +++ b/typo3/sysext/core/Classes/Resource/Collection/FileCollectionRegistry.php @@ -59,7 +59,7 @@ class FileCollectionRegistry implements SingletonInterface throw new \InvalidArgumentException('Class ' . $className . ' does not exist.', 1391295613); } - if (!in_array(AbstractFileCollection::class, class_parents($className), true)) { + if (!in_array(AbstractFileCollection::class, class_parents($className) ?: [], true)) { throw new \InvalidArgumentException('FileCollection ' . $className . ' needs to extend the AbstractFileCollection.', 1391295633); } diff --git a/typo3/sysext/core/Classes/Resource/Driver/DriverRegistry.php b/typo3/sysext/core/Classes/Resource/Driver/DriverRegistry.php index f506b17a54bfcedcfc86afcfae87c91b55e84ba0..3cdf16876a1fbfccf10f3d118e97598634331deb 100644 --- a/typo3/sysext/core/Classes/Resource/Driver/DriverRegistry.php +++ b/typo3/sysext/core/Classes/Resource/Driver/DriverRegistry.php @@ -64,7 +64,7 @@ class DriverRegistry implements SingletonInterface throw new \InvalidArgumentException('Class ' . $className . ' does not exist.', 1314979197); } - if (!in_array(DriverInterface::class, class_implements($className), true)) { + if (!in_array(DriverInterface::class, class_implements($className) ?: [], true)) { throw new \InvalidArgumentException('Driver ' . $className . ' needs to implement the DriverInterface.', 1387619575); } if ($shortName === '') { diff --git a/typo3/sysext/core/Classes/Resource/Index/ExtractorRegistry.php b/typo3/sysext/core/Classes/Resource/Index/ExtractorRegistry.php index 6ba66e0e38f8870499576607a83fbe6b6e7b79c1..262de490824ad564f6450bfdaff2e25d607f74cf 100644 --- a/typo3/sysext/core/Classes/Resource/Index/ExtractorRegistry.php +++ b/typo3/sysext/core/Classes/Resource/Index/ExtractorRegistry.php @@ -57,7 +57,7 @@ class ExtractorRegistry implements SingletonInterface if (!class_exists($className)) { throw new \InvalidArgumentException('The class "' . $className . '" you are registering is not available', 1422705270); } - if (!in_array(ExtractorInterface::class, class_implements($className))) { + if (!in_array(ExtractorInterface::class, class_implements($className) ?: [])) { throw new \InvalidArgumentException('The extractor needs to implement the ExtractorInterface', 1422705271); } $this->extractors[] = $className; diff --git a/typo3/sysext/core/Classes/Resource/Rendering/RendererRegistry.php b/typo3/sysext/core/Classes/Resource/Rendering/RendererRegistry.php index 59791d34249fa97d664f5387350960e2b681fb06..747cec68eb0c944d18535ad148d1850677043dcf 100644 --- a/typo3/sysext/core/Classes/Resource/Rendering/RendererRegistry.php +++ b/typo3/sysext/core/Classes/Resource/Rendering/RendererRegistry.php @@ -59,7 +59,7 @@ class RendererRegistry implements SingletonInterface if (!class_exists($className)) { throw new \InvalidArgumentException('The class "' . $className . '" you are trying to register is not available', 1411840171); } - if (!in_array(FileRendererInterface::class, class_implements($className), true)) { + if (!in_array(FileRendererInterface::class, class_implements($className) ?: [], true)) { throw new \InvalidArgumentException('The renderer needs to implement the FileRendererInterface', 1411840172); } $this->classNames[] = $className; diff --git a/typo3/sysext/core/Classes/Resource/Security/FileMetadataPermissionsAspect.php b/typo3/sysext/core/Classes/Resource/Security/FileMetadataPermissionsAspect.php index 2e80e3c2b6c5800982f48a0bfb613805b6a8e733..b05e4b522f50d859fcda5ad861e633bfc621254b 100644 --- a/typo3/sysext/core/Classes/Resource/Security/FileMetadataPermissionsAspect.php +++ b/typo3/sysext/core/Classes/Resource/Security/FileMetadataPermissionsAspect.php @@ -92,7 +92,7 @@ class FileMetadataPermissionsAspect implements DataHandlerCheckModifyAccessListH $recordAccessAllowed = false; if (strpos((string)$id, 'NEW') === false) { - $fileMetadataRecord = BackendUtility::getRecord('sys_file_metadata', $id); + $fileMetadataRecord = BackendUtility::getRecord('sys_file_metadata', (int)$id); if ($fileMetadataRecord !== null) { if ($parent->isImporting && empty($fileMetadataRecord['file'])) { // When importing the record was added with an empty file relation as first step diff --git a/typo3/sysext/core/Classes/Resource/Service/ImageProcessingService.php b/typo3/sysext/core/Classes/Resource/Service/ImageProcessingService.php index cccb3fd2a27e1017ade0ff3fa49204a1c2759ea1..65a8c64d5210f57b9683d891a82f0583f09ffa7f 100644 --- a/typo3/sysext/core/Classes/Resource/Service/ImageProcessingService.php +++ b/typo3/sysext/core/Classes/Resource/Service/ImageProcessingService.php @@ -61,6 +61,7 @@ class ImageProcessingService $this->locker->acquireLock(self::class, $processedFileId); // Fetch the processed file again, as it might have been processed by another process while waiting for the lock + /** @var ProcessedFile $processedFile */ $processedFile = $this->processedFileRepository->findByUid($processedFileId); $this->validateProcessedFile($processedFile); diff --git a/typo3/sysext/core/Classes/Resource/SynchronizeFolderRelations.php b/typo3/sysext/core/Classes/Resource/SynchronizeFolderRelations.php index 611d30257e527cd069bdeb0dacc16b9c810e5b39..c108218222445d155d278d7ba06beda69a5093c3 100644 --- a/typo3/sysext/core/Classes/Resource/SynchronizeFolderRelations.php +++ b/typo3/sysext/core/Classes/Resource/SynchronizeFolderRelations.php @@ -82,7 +82,7 @@ class SynchronizeFolderRelations } if ($synchronized) { - $this->addFlashMessage($synchronized, 'sys_file_collection', 'afterFolderRenamed'); + $this->addFlashMessage((int)$synchronized, 'sys_file_collection', 'afterFolderRenamed'); } } @@ -123,7 +123,7 @@ class SynchronizeFolderRelations } if ($synchronized) { - $this->addFlashMessage($synchronized, 'sys_filemounts', 'afterFolderRenamed'); + $this->addFlashMessage((int)$synchronized, 'sys_filemounts', 'afterFolderRenamed'); } } diff --git a/typo3/sysext/core/Classes/Resource/TextExtraction/TextExtractorRegistry.php b/typo3/sysext/core/Classes/Resource/TextExtraction/TextExtractorRegistry.php index 48b03b6531f19df4859e3877b6ef1b1dbdb9d975..50c37597d28b838a343a058abe4f66e6b66ed8c8 100644 --- a/typo3/sysext/core/Classes/Resource/TextExtraction/TextExtractorRegistry.php +++ b/typo3/sysext/core/Classes/Resource/TextExtraction/TextExtractorRegistry.php @@ -60,7 +60,7 @@ class TextExtractorRegistry implements SingletonInterface throw new \InvalidArgumentException('The class "' . $className . '" you are trying to register is not available', 1422906893); } - if (!in_array(TextExtractorInterface::class, class_implements($className), true)) { + if (!in_array(TextExtractorInterface::class, class_implements($className) ?: [], true)) { throw new \InvalidArgumentException($className . ' must implement interface' . TextExtractorInterface::class, 1422771427); } diff --git a/typo3/sysext/core/Classes/Routing/Aspect/AspectFactory.php b/typo3/sysext/core/Classes/Routing/Aspect/AspectFactory.php index 6117675a62131fcb8251d999dcf04b34c064afca..7dea0ff3f293d7f99542e332e6ff8cc7ad34b194 100644 --- a/typo3/sysext/core/Classes/Routing/Aspect/AspectFactory.php +++ b/typo3/sysext/core/Classes/Routing/Aspect/AspectFactory.php @@ -115,7 +115,7 @@ class AspectFactory protected function enrich(AspectInterface $aspect, SiteLanguage $language, Site $site): AspectInterface { // the check for the trait is @deprecated and can be removed at any time after TYPO3 v11 - if ($aspect instanceof SiteLanguageAwareInterface || in_array(SiteLanguageAwareTrait::class, class_uses($aspect), true)) { + if ($aspect instanceof SiteLanguageAwareInterface || in_array(SiteLanguageAwareTrait::class, class_uses($aspect) ?: [], true)) { /** @var AspectInterface|SiteLanguageAwareInterface $aspect */ $aspect->setSiteLanguage($language); } diff --git a/typo3/sysext/core/Classes/Routing/Route.php b/typo3/sysext/core/Classes/Routing/Route.php index 3c8a509e48cd94b2f5f5f12b66be5532797488cd..e6e9a9a50bb201aa6020642e5847dc19860ec0ec 100644 --- a/typo3/sysext/core/Classes/Routing/Route.php +++ b/typo3/sysext/core/Classes/Routing/Route.php @@ -180,7 +180,7 @@ class Route extends SymfonyRoute return array_filter( $aspects, function (AspectInterface $aspect) use ($classNames) { - $uses = class_uses($aspect); + $uses = class_uses($aspect) ?: []; foreach ($classNames as $className) { if (!is_a($aspect, $className) && !in_array($className, $uses, true) diff --git a/typo3/sysext/extbase/Classes/Persistence/ClassesConfigurationFactory.php b/typo3/sysext/extbase/Classes/Persistence/ClassesConfigurationFactory.php index 8fd52a3005ca9a24af634d6bdcb078299794503f..e97f31f21460ec6f88ca7770171789e8b248f8ff 100644 --- a/typo3/sysext/extbase/Classes/Persistence/ClassesConfigurationFactory.php +++ b/typo3/sysext/extbase/Classes/Persistence/ClassesConfigurationFactory.php @@ -115,7 +115,7 @@ final class ClassesConfigurationFactory implements SingletonInterface * parents of $className until one of these parents. */ $relevantParentClasses = []; - $parentClasses = class_parents($className); + $parentClasses = class_parents($className) ?: []; while (null !== $parentClass = array_shift($parentClasses)) { if (in_array($parentClass, [AbstractEntity::class, AbstractValueObject::class], true)) { break; diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php index 52f31b8db6fecd058277756d8396c27396bcb504..16b43e78c8950453d215277475bf378cafbe1d0d 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Mapper/DataMapper.php @@ -197,7 +197,7 @@ class DataMapper { // Note: The class_implements() function also invokes autoload to assure that the interfaces // and the class are loaded. Would end up with __PHP_Incomplete_Class without it. - if (!in_array(DomainObjectInterface::class, class_implements($className))) { + if (!in_array(DomainObjectInterface::class, class_implements($className) ?: [])) { throw new CannotReconstituteObjectException('Cannot create empty instance of the class "' . $className . '" because it does not implement the TYPO3\\CMS\\Extbase\\DomainObject\\DomainObjectInterface.', 1234386924); } diff --git a/typo3/sysext/extbase/Classes/Property/PropertyMapper.php b/typo3/sysext/extbase/Classes/Property/PropertyMapper.php index 1cc653e925dad4acfd35eb94e16b782dc9190f0b..941d3771ef6f6b664d2ceee8f5d16baab2c74fc8 100644 --- a/typo3/sysext/extbase/Classes/Property/PropertyMapper.php +++ b/typo3/sysext/extbase/Classes/Property/PropertyMapper.php @@ -306,7 +306,7 @@ class PropertyMapper implements SingletonInterface } } - $converters = $this->getConvertersForInterfaces($convertersForSource, class_implements($targetClass)); + $converters = $this->getConvertersForInterfaces($convertersForSource, class_implements($targetClass) ?: []); $converter = $this->findEligibleConverterWithHighestPriority($converters, $source, $targetClass); if ($converter !== null) { diff --git a/typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php b/typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php index 256b4783b7385d6157a5a1360fad614548566077..8e44962f189d75a97eec55e8363c1137935f84e4 100644 --- a/typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php +++ b/typo3/sysext/extbase/Classes/Validation/ValidatorResolver.php @@ -158,7 +158,7 @@ class ValidatorResolver implements SingletonInterface ] ); $objectValidator->addPropertyValidator($property->getName(), $collectionValidator); - } elseif (class_exists($propertyTargetClassName) && !TypeHandlingUtility::isCoreType($propertyTargetClassName) && !in_array(SingletonInterface::class, class_implements($propertyTargetClassName, true), true)) { + } elseif (class_exists($propertyTargetClassName) && !TypeHandlingUtility::isCoreType($propertyTargetClassName) && !in_array(SingletonInterface::class, class_implements($propertyTargetClassName, true) ?: [], true)) { /* * class_exists($propertyTargetClassName) checks, if the type of the property is an object * instead of a simple type. Like DateTime or another model. diff --git a/typo3/sysext/extensionmanager/Classes/Controller/ListController.php b/typo3/sysext/extensionmanager/Classes/Controller/ListController.php index 4a5db1f3d21804e3d53590d7637d0a88a25d3632..3bd4809b70161601d8a9d6f7aa4dffdc19ac7a7e 100644 --- a/typo3/sysext/extensionmanager/Classes/Controller/ListController.php +++ b/typo3/sysext/extensionmanager/Classes/Controller/ListController.php @@ -29,6 +29,7 @@ use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Mvc\View\ViewInterface; use TYPO3\CMS\Extbase\Pagination\QueryResultPaginator; +use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; use TYPO3\CMS\Extbase\Utility\LocalizationUtility; use TYPO3\CMS\Extensionmanager\Domain\Model\Extension; use TYPO3\CMS\Extensionmanager\Domain\Repository\ExtensionRepository; @@ -207,6 +208,7 @@ class ListController extends AbstractModuleController $paginator = new ArrayPaginator($extensions, $currentPage); $tableId = 'terSearchTable'; } else { + /** @var QueryResultInterface $extensions */ $extensions = $this->extensionRepository->findAll(); $paginator = new QueryResultPaginator($extensions, $currentPage); $tableId = 'terTable'; diff --git a/typo3/sysext/extensionmanager/Classes/Domain/Model/Extension.php b/typo3/sysext/extensionmanager/Classes/Domain/Model/Extension.php index 889fdb735c3dd5af44951885847bf1924824701b..4a9ac9536e0da42d349fc20dcf15c6964fdc7adf 100644 --- a/typo3/sysext/extensionmanager/Classes/Domain/Model/Extension.php +++ b/typo3/sysext/extensionmanager/Classes/Domain/Model/Extension.php @@ -676,7 +676,7 @@ class Extension extends AbstractEntity } foreach ($dependencyValues as $dependency => $versionConstraint) { if ($dependency) { - $dependencyObject = Dependency::createFromEmConf($dependency, $versionConstraint, $dependencyType); + $dependencyObject = Dependency::createFromEmConf((string)$dependency, $versionConstraint, (string)$dependencyType); $dependenciesObject->attach($dependencyObject); } } diff --git a/typo3/sysext/extensionmanager/Classes/Remote/TerExtensionRemote.php b/typo3/sysext/extensionmanager/Classes/Remote/TerExtensionRemote.php index 113f5f7361c59df7fa8dfdb1f80322fcd7169733..2e8a69bfdbd895e17915ab8bbac8fd8f365490c8 100644 --- a/typo3/sysext/extensionmanager/Classes/Remote/TerExtensionRemote.php +++ b/typo3/sysext/extensionmanager/Classes/Remote/TerExtensionRemote.php @@ -101,7 +101,7 @@ class TerExtensionRemote implements ExtensionDownloaderRemoteInterface, Listable try { $response = $this->downloadFile('extensions.md5'); $md5SumOfRemoteExtensionListFile = $response->getBody()->getContents(); - return hash_equals($md5SumOfRemoteExtensionListFile, md5_file($this->localExtensionListCacheFile)); + return hash_equals($md5SumOfRemoteExtensionListFile, md5_file($this->localExtensionListCacheFile) ?: ''); } catch (DownloadFailedException $exception) { return false; } @@ -203,7 +203,7 @@ class TerExtensionRemote implements ExtensionDownloaderRemoteInterface, Listable [$expectedHash, $compressionType, $contents] = explode(':', $stream, 3); if ($compressionType === 'gzcompress') { if (function_exists('gzuncompress')) { - $contents = gzuncompress($contents); + $contents = gzuncompress($contents) ?: ''; } else { throw new VerificationFailedException('No decompressor available for compressed content. gzcompress()/gzuncompress() functions are not available', 1601370681); } diff --git a/typo3/sysext/filelist/Classes/FileFacade.php b/typo3/sysext/filelist/Classes/FileFacade.php index 189710edea89d5be7acdcdbf47655d6703585881..32741b66e7ab2d4a002e5754eb74e3b3defda502 100644 --- a/typo3/sysext/filelist/Classes/FileFacade.php +++ b/typo3/sysext/filelist/Classes/FileFacade.php @@ -134,7 +134,7 @@ class FileFacade */ public function getPublicUrl() { - return PathUtility::getAbsoluteWebPath($this->resource->getPublicUrl()); + return PathUtility::getAbsoluteWebPath($this->resource->getPublicUrl() ?? ''); } /** diff --git a/typo3/sysext/filelist/Classes/FileList.php b/typo3/sysext/filelist/Classes/FileList.php index 21f7c4e56c52b7335eddf940378e26198f4b7f74..4ea3ae756bc602b4c9c0e68f36b3bf7c5da5a7fe 100644 --- a/typo3/sysext/filelist/Classes/FileList.php +++ b/typo3/sysext/filelist/Classes/FileList.php @@ -567,7 +567,7 @@ class FileList // The icon with link $theIcon = '<span title="' . htmlspecialchars($folderName) . '">' . $this->iconFactory->getIconForResource($folderObject, Icon::SIZE_SMALL)->render() . '</span>'; if (!$isLocked) { - $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, 'sys_file', $folderObject->getCombinedIdentifier()); + $theIcon = (string)BackendUtility::wrapClickMenuOnIcon($theIcon, 'sys_file', $folderObject->getCombinedIdentifier()); } // Preparing and getting the data-array @@ -716,7 +716,7 @@ class FileList // The icon with link $theIcon = '<span title="' . htmlspecialchars($fileName . ' [' . (int)$fileObject->getUid() . ']') . '">' . $this->iconFactory->getIconForResource($fileObject, Icon::SIZE_SMALL)->render() . '</span>'; - $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, 'sys_file', $fileObject->getCombinedIdentifier()); + $theIcon = (string)BackendUtility::wrapClickMenuOnIcon($theIcon, 'sys_file', $fileObject->getCombinedIdentifier()); // Preparing and getting the data-array $theData = []; foreach ($this->fieldArray as $field) { @@ -806,7 +806,7 @@ class FileList 'height' => $this->thumbnailConfiguration->getHeight(), ] ); - $theData[$field] .= '<br /><img src="' . htmlspecialchars(PathUtility::getAbsoluteWebPath($processedFile->getPublicUrl())) . '" ' . + $theData[$field] .= '<br /><img src="' . htmlspecialchars(PathUtility::getAbsoluteWebPath($processedFile->getPublicUrl() ?? '')) . '" ' . 'width="' . htmlspecialchars($processedFile->getProperty('width')) . '" ' . 'height="' . htmlspecialchars($processedFile->getProperty('height')) . '" ' . 'title="' . htmlspecialchars($fileName) . '" alt="" />'; diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Be/Labels/CshViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Be/Labels/CshViewHelper.php index ac84acb772de6fa535243199ff512d2cbea0d423..e06211deb7ef8e3bfe521889e334638a7dfd1ba3 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Be/Labels/CshViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Be/Labels/CshViewHelper.php @@ -112,7 +112,7 @@ class CshViewHelper extends AbstractBackendViewHelper $label = self::getLanguageService()->sL($label); } // Double encode can be set to true, once the typo3fluid/fluid fix is released and required - $label = '<label>' . htmlspecialchars($label, ENT_QUOTES, null, false) . '</label>'; + $label = '<label>' . htmlspecialchars($label, ENT_QUOTES, '', false) . '</label>'; return BackendUtility::wrapInHelp($table, $field, $label); } } diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Be/Menus/ActionMenuItemViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Be/Menus/ActionMenuItemViewHelper.php index df6ad8e1777280be60d6a22cc2368cb1bb67233a..6887a91d9356cdd65cd6d5bd635614edbd48f79e 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Be/Menus/ActionMenuItemViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Be/Menus/ActionMenuItemViewHelper.php @@ -95,7 +95,7 @@ class ActionMenuItemViewHelper extends AbstractTagBasedViewHelper $this->tag->setContent( // Double encode can be set to true, once the typo3fluid/fluid fix is released and required - htmlspecialchars($label, ENT_QUOTES, null, false) + htmlspecialchars($label, ENT_QUOTES, '', false) ); return $this->tag->render(); } diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormViewHelper.php index 024921d280993d6d4131e2e3854028e75d640f7d..bb3a5b9ab5706bbbebd00659ee78573326fb4328 100644 --- a/typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormViewHelper.php +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Form/AbstractFormViewHelper.php @@ -96,7 +96,7 @@ abstract class AbstractFormViewHelper extends AbstractTagBasedViewHelper $name = $this->prefixFieldName($name) . '[__identity]'; $this->registerFieldNameForFormTokenGeneration($name); - return LF . '<input type="hidden" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars($identifier) . '" />' . LF; + return LF . '<input type="hidden" name="' . htmlspecialchars($name) . '" value="' . htmlspecialchars((string)$identifier) . '" />' . LF; } /** diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentDataProcessor.php b/typo3/sysext/frontend/Classes/ContentObject/ContentDataProcessor.php index 052fa1362b04916220e4e15eb2835abf302dcc68..01671561c9fa3f66c05be1e109a06ccfd4f5b3dc 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentDataProcessor.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentDataProcessor.php @@ -47,7 +47,7 @@ class ContentDataProcessor throw new \UnexpectedValueException('Processor class name "' . $className . '" does not exist!', 1427455378); } - if (!in_array(DataProcessorInterface::class, class_implements($className), true)) { + if (!in_array(DataProcessorInterface::class, class_implements($className) ?: [], true)) { throw new \UnexpectedValueException( 'Processor with class name "' . $className . '" ' . 'must implement interface "' . DataProcessorInterface::class . '"', diff --git a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php index 9c24a3a85eaba76ed2260433a1c6969f1cca5430..b54dab4e9161529350fea814b84dd78ec6978e2d 100644 --- a/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php +++ b/typo3/sysext/frontend/Classes/ContentObject/ContentObjectRenderer.php @@ -1086,7 +1086,7 @@ class ContentObjectRenderer implements LoggerAwareInterface if ($conf['JSwindow']) { $altUrl = $this->stdWrapValue('altUrl', $conf['JSwindow.'] ?? []); if ($altUrl) { - $url = $altUrl . ($conf['JSwindow.']['altUrl_noDefaultParams'] ? '' : '?file=' . rawurlencode($imageFile) . $params); + $url = $altUrl . ($conf['JSwindow.']['altUrl_noDefaultParams'] ? '' : '?file=' . rawurlencode((string)$imageFile) . $params); } $processedFile = $file->process(ProcessedFile::CONTEXT_IMAGECROPSCALEMASK, $conf); @@ -1117,9 +1117,9 @@ class ContentObjectRenderer implements LoggerAwareInterface $onClick = 'openPic(' . GeneralUtility::quoteJSvalue($this->getTypoScriptFrontendController()->baseUrlWrap($url)) . ',' - . '\'' . ($newWindow ? md5($url) : 'thePicture') . '\',' + . '\'' . ($newWindow ? md5((string)$url) : 'thePicture') . '\',' . GeneralUtility::quoteJSvalue(rtrim($paramString, ',')) . '); return false;'; - $a1 = '<a href="' . htmlspecialchars($url) . '"' + $a1 = '<a href="' . htmlspecialchars((string)$url) . '"' . ' onclick="' . htmlspecialchars($onClick) . '"' . ($target !== '' ? ' target="' . htmlspecialchars($target) . '"' : '') . $this->getTypoScriptFrontendController()->ATagParams . '>'; @@ -1970,7 +1970,7 @@ class ContentObjectRenderer implements LoggerAwareInterface ? gmstrftime($conf['strftime'] ?? null, $content) : strftime($conf['strftime'] ?? null, $content); if (!empty($conf['strftime.']['charset'])) { - $output = mb_convert_encoding($content, 'utf-8', trim(strtolower($conf['strftime.']['charset']))); + $output = mb_convert_encoding((string)$content, 'utf-8', trim(strtolower($conf['strftime.']['charset']))); return $output ?: $content; } return $content; diff --git a/typo3/sysext/indexed_search/Classes/Controller/SearchController.php b/typo3/sysext/indexed_search/Classes/Controller/SearchController.php index fba53af49a2891a340d31e3a958e6ad267ef140e..6f43f7c057df03f0d38f558c6962a9f2dd1e1e75 100644 --- a/typo3/sysext/indexed_search/Classes/Controller/SearchController.php +++ b/typo3/sysext/indexed_search/Classes/Controller/SearchController.php @@ -1107,7 +1107,7 @@ class SearchController extends ActionController } // disable single entries by TypoScript - $allOptions = $this->removeOptionsFromOptionList($allOptions, $blindSettings['languageUid']); + $allOptions = $this->removeOptionsFromOptionList($allOptions, (array)$blindSettings['languageUid']); } else { $allOptions = []; } @@ -1202,7 +1202,7 @@ class SearchController extends ActionController } } // disable single entries by TypoScript - $allOptions = $this->removeOptionsFromOptionList($allOptions, $blindSettings['indexingConfigurations']); + $allOptions = $this->removeOptionsFromOptionList($allOptions, (array)$blindSettings['indexingConfigurations']); } else { $allOptions = []; } diff --git a/typo3/sysext/install/Classes/Controller/InstallerController.php b/typo3/sysext/install/Classes/Controller/InstallerController.php index 1f81883f9a95e2a45a8692da13248502bc106e6d..1625918b4d1ede71c7d01625d5edbb45b105d108 100644 --- a/typo3/sysext/install/Classes/Controller/InstallerController.php +++ b/typo3/sysext/install/Classes/Controller/InstallerController.php @@ -1090,7 +1090,7 @@ For each website you need a TypoScript template on the main page of your website $this->lateBootService->loadExtLocalconfDatabaseAndExtTables(); if (!empty($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'])) { foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update'] as $updateClassName) { - if (!in_array(RepeatableInterface::class, class_implements($updateClassName), true)) { + if (!in_array(RepeatableInterface::class, class_implements($updateClassName) ?: [], true)) { $this->registry->set('installUpdate', $updateClassName, 1); } } diff --git a/typo3/sysext/install/Classes/Updates/DatabaseRowsUpdateWizard.php b/typo3/sysext/install/Classes/Updates/DatabaseRowsUpdateWizard.php index effd3fda0121a563e966520cb63ee9344280a6fc..aef97508c8dfffd5cbb54e9fab4df0dc94d17bb2 100644 --- a/typo3/sysext/install/Classes/Updates/DatabaseRowsUpdateWizard.php +++ b/typo3/sysext/install/Classes/Updates/DatabaseRowsUpdateWizard.php @@ -164,7 +164,7 @@ class DatabaseRowsUpdateWizard implements UpgradeWizardInterface, RepeatableInte // and throw away all tables before that start point. sort($listOfAllTables); reset($listOfAllTables); - $firstTable = current($listOfAllTables); + $firstTable = current($listOfAllTables) ?: ''; $startPosition = $this->getStartPosition($firstTable); foreach ($listOfAllTables as $key => $table) { if ($table === $startPosition['table']) { diff --git a/typo3/sysext/install/Classes/Updates/RowUpdater/WorkspaceNewPlaceholderRemovalMigration.php b/typo3/sysext/install/Classes/Updates/RowUpdater/WorkspaceNewPlaceholderRemovalMigration.php index 74cc5e8b306a932452fcf76461b3403b04934885..07fe911431b85328f5c914626d5d577855e4a5eb 100644 --- a/typo3/sysext/install/Classes/Updates/RowUpdater/WorkspaceNewPlaceholderRemovalMigration.php +++ b/typo3/sysext/install/Classes/Updates/RowUpdater/WorkspaceNewPlaceholderRemovalMigration.php @@ -69,8 +69,8 @@ class WorkspaceNewPlaceholderRemovalMigration implements RowUpdaterInterface, Lo if (in_array($fieldName, ['uid', 'pid', 'deleted', 't3ver_state', 't3ver_oid'], true)) { continue; } - if ($this->isMMField($tableName, $fieldName)) { - $this->transferMMValues($tableName, $fieldName, (int)$versionedRecord['uid'], (int)$row['uid']); + if ($this->isMMField($tableName, (string)$fieldName)) { + $this->transferMMValues($tableName, (string)$fieldName, (int)$versionedRecord['uid'], (int)$row['uid']); continue; } $row[$fieldName] = $value; diff --git a/typo3/sysext/linkvalidator/ext_tables.php b/typo3/sysext/linkvalidator/ext_tables.php index 0406dcfe2f6ffbf24fcd2d8e3f2fad41fe82fe3f..597ca4932edd9ccf27353f13f7ea4a66c392f729 100644 --- a/typo3/sysext/linkvalidator/ext_tables.php +++ b/typo3/sysext/linkvalidator/ext_tables.php @@ -6,7 +6,7 @@ defined('TYPO3') or die(); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::insertModuleFunction( 'web_info', \TYPO3\CMS\Linkvalidator\Report\LinkValidatorReport::class, - null, + '', 'LLL:EXT:linkvalidator/Resources/Private/Language/locallang.xlf:mod_linkvalidator' ); diff --git a/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php b/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php index e729e98e9b90f091c54a9412edc0a419cc555d11..a518642ef4b2bbf506caebb1b449bfb2392e4f93 100644 --- a/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php +++ b/typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php @@ -1221,7 +1221,7 @@ class DatabaseRecordList $tagAttributes ); - $rowOutput .= $this->addElement(1, $theIcon, $theData, GeneralUtility::implodeAttributes($tagAttributes, true)); + $rowOutput .= $this->addElement(1, (string)$theIcon, $theData, GeneralUtility::implodeAttributes($tagAttributes, true)); // Finally, return table row element: return $rowOutput; } diff --git a/typo3/sysext/scheduler/Classes/Task/FileStorageExtractionTask.php b/typo3/sysext/scheduler/Classes/Task/FileStorageExtractionTask.php index 0d2cb90084440dcbc02ffcb4070b32bdc4d54b3e..07cf30255b7a7fc42043d64d74c9d17bc01dc1e2 100644 --- a/typo3/sysext/scheduler/Classes/Task/FileStorageExtractionTask.php +++ b/typo3/sysext/scheduler/Classes/Task/FileStorageExtractionTask.php @@ -50,6 +50,9 @@ class FileStorageExtractionTask extends AbstractTask $success = false; if ((int)$this->storageUid > 0) { $storage = GeneralUtility::makeInstance(StorageRepository::class)->findByUid($this->storageUid); + if ($storage === null) { + throw new \RuntimeException(self::class . ' misconfiguration: "Storage to index" must be an existing storage.', 1615020909); + } $currentEvaluatePermissionsValue = $storage->getEvaluatePermissions(); $storage->setEvaluatePermissions(false); $indexer = $this->getIndexer($storage); diff --git a/typo3/sysext/scheduler/Classes/Task/FileStorageIndexingTask.php b/typo3/sysext/scheduler/Classes/Task/FileStorageIndexingTask.php index 175dc630cafd92e7347903a748d167ffefd1d572..cb6e61fffda467e57aee04975bc0715300aa7d44 100644 --- a/typo3/sysext/scheduler/Classes/Task/FileStorageIndexingTask.php +++ b/typo3/sysext/scheduler/Classes/Task/FileStorageIndexingTask.php @@ -42,6 +42,9 @@ class FileStorageIndexingTask extends AbstractTask { if ((int)$this->storageUid > 0) { $storage = GeneralUtility::makeInstance(StorageRepository::class)->findByUid($this->storageUid); + if ($storage === null) { + throw new \RuntimeException(self::class . ' misconfiguration: "Storage to index" must be an existing storage.', 1615020908); + } $currentEvaluatePermissionsValue = $storage->getEvaluatePermissions(); $storage->setEvaluatePermissions(false); $indexer = $this->getIndexer($storage); diff --git a/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php b/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php index 5b1d428e08da535570170dcce5d979da119417ea..592434a31bb6f9f27b1a9622c01393cf7e9076c3 100644 --- a/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php +++ b/typo3/sysext/viewpage/Classes/Controller/ViewModuleController.php @@ -378,7 +378,7 @@ class ViewModuleController protected function getShortcutTitle(int $pageId): string { $pageTitle = ''; - $pageRow = BackendUtility::getRecord('pages', $pageId); + $pageRow = BackendUtility::getRecord('pages', $pageId) ?? []; if ($pageRow !== []) { $pageTitle = BackendUtility::getRecordTitle('pages', $pageRow); } diff --git a/typo3/sysext/workspaces/Classes/Controller/Remote/ActionHandler.php b/typo3/sysext/workspaces/Classes/Controller/Remote/ActionHandler.php index 065a0356642928e16f92c5eacefe964e8df0ee17..580a9c0769e5ba8b3514dc0324794ae75248a474 100644 --- a/typo3/sysext/workspaces/Classes/Controller/Remote/ActionHandler.php +++ b/typo3/sysext/workspaces/Classes/Controller/Remote/ActionHandler.php @@ -273,6 +273,9 @@ class ActionHandler if (!$stageRecord->isEditStage()) { $this->stageService->getRecordService()->add($table, $uid); $previousStageRecord = $stageRecord->getPrevious(); + if ($previousStageRecord === null) { + return $this->getErrorResponse('error.sendToPrevStage.noPreviousStage', 1287264747); + } $result = $this->getSentToStageWindow($previousStageRecord); $result['affects'] = [ 'table' => $table, @@ -643,6 +646,7 @@ class ActionHandler } $result = []; + // TODO: $nextStage might be null, error ignored in phpstan.neon if ($nextStage->isDialogEnabled()) { $result['sendMailTo'] = $this->getRecipientsOfStage($nextStage); $result['additional'] = [ diff --git a/typo3/sysext/workspaces/Classes/Controller/Remote/RemoteServer.php b/typo3/sysext/workspaces/Classes/Controller/Remote/RemoteServer.php index d9706ef44087b64abb6ec842f30c9441d75ae032..6a4fc40bf559dbb8012c0f69a99700391c92cb62 100644 --- a/typo3/sysext/workspaces/Classes/Controller/Remote/RemoteServer.php +++ b/typo3/sysext/workspaces/Classes/Controller/Remote/RemoteServer.php @@ -245,7 +245,7 @@ class RemoteServer 'content' => BackendUtility::getProcessedValue( $parameter->table, $fieldName, - $liveReturnArray[$fieldName], + (string)$liveReturnArray[$fieldName], 0, true, false, @@ -394,7 +394,7 @@ class RemoteServer ProcessedFile::CONTEXT_IMAGEPREVIEW, ['width' => 40, 'height' => 40] ); - $thumbnailMarkup = '<img src="' . PathUtility::getAbsoluteWebPath($thumbnailFile->getPublicUrl()) . '" />'; + $thumbnailMarkup = '<img src="' . PathUtility::getAbsoluteWebPath($thumbnailFile->getPublicUrl() ?? '') . '" />'; $substitutes[$identifierWithRandomValue] = $thumbnailMarkup; } else { $substitutes[$identifierWithRandomValue] = $fileReference->getPublicUrl(); diff --git a/typo3/sysext/workspaces/Classes/Controller/ReviewController.php b/typo3/sysext/workspaces/Classes/Controller/ReviewController.php index 090ff7b9d9556d31790e09c8b966226171ac764f..f1c7f356a36e54f542e870418c471e7c04bc3198 100644 --- a/typo3/sysext/workspaces/Classes/Controller/ReviewController.php +++ b/typo3/sysext/workspaces/Classes/Controller/ReviewController.php @@ -225,7 +225,7 @@ class ReviewController 'title' => $workspaceTitle, 'itemId' => 'workspace-' . $workspaceId, 'workspaceId' => $workspaceId, - 'triggerUrl' => $this->getModuleUri($workspaceId), + 'triggerUrl' => $this->getModuleUri((int)$workspaceId), ]; } diff --git a/typo3/sysext/workspaces/Classes/Hook/DataHandlerHook.php b/typo3/sysext/workspaces/Classes/Hook/DataHandlerHook.php index 69005a89a7bcd2b5db813f2aad82627c754f846a..126a8e21d1fbae86d126fcbf5fa466a13829fca9 100644 --- a/typo3/sysext/workspaces/Classes/Hook/DataHandlerHook.php +++ b/typo3/sysext/workspaces/Classes/Hook/DataHandlerHook.php @@ -558,7 +558,7 @@ class DataHandlerHook $curVersion = BackendUtility::getRecord($table, $id, '*'); // Versioned records which contents will be moved into $curVersion $isNewRecord = ((int)($curVersion['t3ver_state'] ?? 0) === VersionState::NEW_PLACEHOLDER); - if ($isNewRecord) { + if ($isNewRecord && is_array($curVersion)) { $this->publishNewRecord($table, $curVersion, $dataHandler, $comment, (array)$notificationAlternativeRecipients); return; }