Skip to content
Snippets Groups Projects
Commit 615fffa6 authored by Oliver Bartsch's avatar Oliver Bartsch Committed by Stefan Bürk
Browse files

[BUGFIX] Prevent PHP errors in FileMount model

This prevents an error triggered by accessing a possible
uninitialized property as well as a possible TypeError in
the newly introduced FileMount model.

Resolves: #99254
Related: #99038
Releases: main
Change-Id: I037ebd1322838f223ed19171b57118d039488936
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/76888


Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarStefan Bürk <stefan@buerk.tech>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarStefan Bürk <stefan@buerk.tech>
Reviewed-by: default avatarOliver Klee <typo3-coding@oliverklee.de>
parent 765d5a89
Branches
Tags
No related merge requests found
......@@ -38,7 +38,7 @@ class FileMount extends AbstractEntity
/**
* Description of the file mount.
*/
protected string $description;
protected string $description = '';
/**
* Identifier of the filemount
......@@ -128,11 +128,13 @@ class FileMount extends AbstractEntity
*/
public function getPath(): string
{
$segments = preg_split('#:/#', $this->identifier);
return $segments[1] ?? '';
return explode(':/', $this->identifier)[1] ?? '';
}
public function getStorage(): ResourceStorage
/**
* @todo This should be part of the ORM not the model class
*/
public function getStorage(): ?ResourceStorage
{
return GeneralUtility::makeInstance(StorageRepository::class)->findByCombinedIdentifier($this->identifier);
}
......
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