Skip to content

Commit

Permalink
[BUGFIX] Fix wrongly used typecast in combination with ?? operator
Browse files Browse the repository at this point in the history
The 'else' part would never be returned in this cases.

Used [a-zA-Z0-9]{3,}\)[^(]?\$.*\?\? to find the cases.
Care, this brings up false positives as well.

Resolves: #91154
Releases: master, 9.5
Change-Id: Ifdb0f75995543c3cc8abeb81aba52e935e9bf9a1
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64270
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Susanne Moog <look@susi.dev>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Susanne Moog <look@susi.dev>
  • Loading branch information
zotornit authored and susannemoog committed Apr 21, 2020
1 parent 208d378 commit 0c3581b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Mail/TransportFactory.php
Expand Up @@ -69,7 +69,7 @@ public function get(array $mailSettings): TransportInterface
$host = $parts[0];
$port = $parts[1] ?? null;
} else {
$host = (string)$mailSettings['transport_smtp_server'] ?? '';
$host = (string)($mailSettings['transport_smtp_server'] ?? '');
$port = null;
}

Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/TypoScript/TemplateService.php
Expand Up @@ -1217,7 +1217,7 @@ protected function addDefaultTypoScript()
} else {
$currentPage = end($this->absoluteRootLine);
try {
$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId((int)$currentPage['uid'] ?? 0);
$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId((int)($currentPage['uid'] ?? 0));
} catch (SiteNotFoundException $exception) {
$site = null;
}
Expand Down
Expand Up @@ -45,7 +45,7 @@ public function checkExternalLink(BrokenLinkAnalysisEvent $event): void
if ($event->getLinkType() !== LinkService::TYPE_URL) {
return;
}
$url = (string)$event->getLinkData()['url'] ?? '';
$url = (string)($event->getLinkData()['url'] ?? '');
if (!empty($url)) {
if ($this->brokenLinkRepository->isLinkTargetBrokenLink($url)) {
$event->markAsBrokenLink('External link is broken');
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/redirects/Classes/Repository/Demand.php
Expand Up @@ -87,7 +87,7 @@ public static function createFromRequest(ServerRequestInterface $request): Deman
}
$sourceHost = $demand['source_host'] ?? '';
$sourcePath = $demand['source_path'] ?? '';
$statusCode = (int)$demand['target_statuscode'] ?? 0;
$statusCode = (int)($demand['target_statuscode'] ?? 0);
$target = $demand['target'] ?? '';
return new self($page, $sourceHost, $sourcePath, $target, $statusCode);
}
Expand Down
Expand Up @@ -194,7 +194,7 @@ protected function storeIncomingData(array $postData)
$beUserId = $backendUser->user['uid'];
$storeRec = [];
$fieldList = $this->getFieldsFromShowItem();
if (is_array($d) && $this->formProtection->validateToken((string)$postData['formToken'] ?? '', 'BE user setup', 'edit')) {
if (is_array($d) && $this->formProtection->validateToken((string)($postData['formToken'] ?? ''), 'BE user setup', 'edit')) {
// UC hashed before applying changes
$save_before = md5(serialize($backendUser->uc));
// PUT SETTINGS into the ->uc array:
Expand Down

0 comments on commit 0c3581b

Please sign in to comment.