Commit 6e75da76 authored by Jochen Roth's avatar Jochen Roth Committed by Benni Mack
Browse files

[BUFIX] Set fallback for undefined array keys in PHP8

Fix undefined array keys in form, core and
indexed_search for the frontend and in
extensionmanager.

Resolves: #94613
Releases: master
Change-Id: I96230feb46f33c9a606a72f765bc79e19d8b28dd
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70024

Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent f155250f
......@@ -1120,7 +1120,7 @@ class PageRepository implements LoggerAwareInterface
}
// Set first Page uid:
if (!$firstPageUid) {
$firstPageUid = (int)($pageRec['l10n_parent'] ?: $pageRec['uid']);
$firstPageUid = (int)($pageRec['l10n_parent'] ?? false) ?: $pageRec['uid'] ?? 0;
}
// Look for mount pid value plus other required circumstances:
$mount_pid = (int)($pageRec['mount_pid'] ?? 0);
......
......@@ -1166,11 +1166,11 @@ class ExtendedTemplateService extends TemplateService
{
$data = $http_post_vars['data'];
$check = $http_post_vars['check'];
$Wdata = $http_post_vars['Wdata'];
$W2data = $http_post_vars['W2data'];
$W3data = $http_post_vars['W3data'];
$W4data = $http_post_vars['W4data'];
$W5data = $http_post_vars['W5data'];
$Wdata = $http_post_vars['Wdata'] ?? [];
$W2data = $http_post_vars['W2data'] ?? [];
$W3data = $http_post_vars['W3data'] ?? [];
$W4data = $http_post_vars['W4data'] ?? [];
$W5data = $http_post_vars['W5data'] ?? [];
if (is_array($data)) {
foreach ($data as $key => $var) {
if (isset($theConstants[$key])) {
......
......@@ -232,7 +232,7 @@ class InstallUtility implements SingletonInterface, LoggerAwareInterface
$dependentExtensions = [];
foreach ($availableAndInstalledExtensions as $availableAndInstalledExtensionKey => $availableAndInstalledExtension) {
if (isset($availableAndInstalledExtension['installed']) && $availableAndInstalledExtension['installed'] === true) {
if (is_array($availableAndInstalledExtension['constraints']) && is_array($availableAndInstalledExtension['constraints']['depends']) && array_key_exists($extensionKey, $availableAndInstalledExtension['constraints']['depends'])) {
if (is_array($availableAndInstalledExtension['constraints'] ?? false) && is_array($availableAndInstalledExtension['constraints']['depends']) && array_key_exists($extensionKey, $availableAndInstalledExtension['constraints']['depends'])) {
$dependentExtensions[] = $availableAndInstalledExtensionKey;
}
}
......
......@@ -117,7 +117,7 @@ class FormFrontendController extends ActionController
$sheetIdentifier = $this->getFlexformSheetIdentifier($formDefinition, $prototypeName, $finisherIdentifier);
$flexFormSheetSettings = $this->getFlexFormSettingsFromSheet($flexFormData, $sheetIdentifier);
if ($this->settings['overrideFinishers'] && isset($flexFormSheetSettings['finishers'][$finisherIdentifier])) {
if (($this->settings['overrideFinishers'] ?? false) && isset($flexFormSheetSettings['finishers'][$finisherIdentifier])) {
$prototypeFinisherDefinition = $prototypeConfiguration['finishersDefinition'][$finisherIdentifier] ?? [];
$converterDto = GeneralUtility::makeInstance(
FlexFormFinisherOverridesConverterDto::class,
......
......@@ -8,7 +8,7 @@ finishers:
options:
subject: 'Your message: {subject}'
recipients:
your.company@example.com: Your Company name'
your.company@example.com: 'Your Company name'
senderAddress: '{email}'
senderName: '{name}'
replyToRecipients: {}
......
......@@ -896,7 +896,7 @@ abstract class AbstractMenuContentObject
}
// If there are keywords and the startuid is present
if ($kw && $startUid) {
$bA = MathUtility::forceIntegerInRange($this->conf['special.']['beginAtLevel'], 0, 100);
$bA = MathUtility::forceIntegerInRange(($this->conf['special.']['beginAtLevel'] ?? 0), 0, 100);
$id_list = $this->parent_cObj->getTreeList(-1 * $startUid, $depth - 1 + $bA, $bA - 1);
$kwArr = GeneralUtility::trimExplode(',', $kw, true);
$keyWordsWhereArr = [];
......
......@@ -552,17 +552,17 @@ class Indexer
// Parse URL:
$qParts = parse_url($linkSource);
// Check for jumpurl (TYPO3 specific thing...)
if ($qParts['query'] && strpos($qParts['query'], 'jumpurl=') !== false) {
if (($qParts['query'] ?? false) && strpos($qParts['query'] ?? '', 'jumpurl=') !== false) {
parse_str($qParts['query'], $getP);
$linkSource = $getP['jumpurl'];
$qParts = parse_url($linkSource);
}
if (!$linkInfo['localPath'] && $qParts['scheme']) {
if (!$linkInfo['localPath'] && ($qParts['scheme'] ?? false)) {
if ($this->indexerConfig['indexExternalURLs']) {
// Index external URL (http or otherwise)
$this->indexExternalUrl($linkSource);
}
} elseif (!$qParts['query']) {
} elseif (!($qParts['query'] ?? false)) {
$linkSource = urldecode($linkSource);
if (GeneralUtility::isAllowedAbsPath($linkSource)) {
$localFile = $linkSource;
......@@ -1914,7 +1914,7 @@ class Indexer
(int)$val['count'],
(int)($val['first'] ?? 0),
$this->freqMap($val['count'] / $this->wordcount),
$val['cmp'] & $this->flagBitMask
($val['cmp'] ?? 0) & $this->flagBitMask
];
}
......
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