Commit e5805210 authored by Oliver Bartsch's avatar Oliver Bartsch Committed by Christian Kuhn
Browse files

[BUGFIX] Fix several PHP 8 warnings for non admin users

Resolves: #94652
Releases: master
Change-Id: I805352b13eae98fd207ca45bbade34c489cc4c6d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70120

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 5d1993bd
......@@ -358,12 +358,14 @@ class BackendUserAuthentication extends AbstractUserAuthentication
. $GLOBALS['TCA']['pages']['ctrl']['languageField']
);
}
if ($checkRec['t3ver_oid'] > 0) {
if ((int)($checkRec['t3ver_oid'] ?? 0) > 0) {
$id = (int)$checkRec['t3ver_oid'];
}
// if current rec is a translation then get uid from l10n_parent instead
// because web mounts point to pages in default language and rootline returns uids of default languages
if ((int)$checkRec[$GLOBALS['TCA']['pages']['ctrl']['languageField']] !== 0 && (int)$checkRec[$GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField']] !== 0) {
if ((int)($checkRec[$GLOBALS['TCA']['pages']['ctrl']['languageField'] ?? null] ?? 0) !== 0
&& (int)($checkRec[$GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField'] ?? null] ?? 0) !== 0
) {
$id = (int)$checkRec[$GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField']];
}
if (!$readPerms) {
......
......@@ -2727,7 +2727,7 @@ class ResourceStorage implements ResourceStorageInterface
if (!empty($this->fileMounts[$identifier]['read_only'])) {
$folderRole = FolderInterface::ROLE_READONLY_MOUNT;
}
if ($this->fileMounts[$identifier]['user_mount']) {
if ($this->fileMounts[$identifier]['user_mount'] ?? false) {
$folderRole = FolderInterface::ROLE_USER_MOUNT;
}
}
......
......@@ -106,8 +106,8 @@ class InternalLinktype extends AbstractLinktype
$this->responseContent = $this->checkContent((int)$page, (int)$anchor);
}
if (
(is_array($this->errorParams['page']) && !$this->responsePage)
|| (is_array($this->errorParams['content']) && !$this->responseContent)
(is_array($this->errorParams['page'] ?? false) && !$this->responsePage)
|| (is_array($this->errorParams['content'] ?? false) && !$this->responseContent)
) {
$this->setErrorParams($this->errorParams);
}
......@@ -269,7 +269,7 @@ class InternalLinktype extends AbstractLinktype
);
}
}
if (is_array($errorParams['content'])) {
if (is_array($errorParams['content'] ?? false)) {
switch ($errorType['content']) {
case self::DELETED:
$errorContent = str_replace(
......
......@@ -667,7 +667,7 @@ class RecordListController
*/
protected function editLockPermissions(): bool
{
return $this->getBackendUserAuthentication()->isAdmin() || !$this->pageInfo['editlock'];
return $this->getBackendUserAuthentication()->isAdmin() || !($this->pageInfo['editlock'] ?? false);
}
/**
......
......@@ -62,7 +62,7 @@ class BackendUtilityHook
{
if ($GLOBALS['BE_USER']->workspace !== 0 && BackendUtility::isTableWorkspaceEnabled($params['table'])) {
$record = BackendUtility::getRecordWSOL($params['table'], $params['uid']);
if (abs($record['t3ver_stage']) > StagesService::STAGE_EDIT_ID) {
if (isset($record['t3ver_stage']) && abs($record['t3ver_stage']) > StagesService::STAGE_EDIT_ID) {
$stages = GeneralUtility::makeInstance(StagesService::class);
$stageName = $stages->getStageTitle($record['t3ver_stage']);
$editingName = $stages->getStageTitle(StagesService::STAGE_EDIT_ID);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment