diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon
index acee5c3f0c1b0f6ba75fd4758e4827096962be1d..e172d852e17cc9f9e37e6b0aa33b939aa92f8199 100644
--- a/Build/phpstan/phpstan-baseline.neon
+++ b/Build/phpstan/phpstan-baseline.neon
@@ -970,16 +970,6 @@ parameters:
 			count: 1
 			path: ../../typo3/sysext/core/Classes/Resource/ResourceFactory.php
 
-		-
-			message: "#^Parameter \\#1 \\$uid of method TYPO3\\\\CMS\\\\Core\\\\Resource\\\\StorageRepository\\:\\:findByUid\\(\\) expects int, string given\\.$#"
-			count: 1
-			path: ../../typo3/sysext/core/Classes/Resource/ResourceFactory.php
-
-		-
-			message: "#^Parameter \\#1 \\$uid of method TYPO3\\\\CMS\\\\Core\\\\Resource\\\\StorageRepository\\:\\:findByUid\\(\\) expects int, string\\|null given\\.$#"
-			count: 1
-			path: ../../typo3/sysext/core/Classes/Resource/ResourceFactory.php
-
 		-
 			message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Core\\\\Resource\\\\FileInterface\\:\\:getCombinedIdentifier\\(\\)\\.$#"
 			count: 2
diff --git a/typo3/sysext/core/Classes/Resource/ResourceFactory.php b/typo3/sysext/core/Classes/Resource/ResourceFactory.php
index c7c6115750507d26171b18a9094fa51ed87ce061..48dbea2cb937a86d847603d6a8289d1a2b59902d 100644
--- a/typo3/sysext/core/Classes/Resource/ResourceFactory.php
+++ b/typo3/sysext/core/Classes/Resource/ResourceFactory.php
@@ -366,9 +366,11 @@ class ResourceFactory implements SingletonInterface
      */
     public function getStorageObjectFromCombinedIdentifier($identifier)
     {
-        $parts = GeneralUtility::trimExplode(':', $identifier);
-        $storageUid = count($parts) === 2 ? $parts[0] : null;
-        return $this->storageRepository->findByUid($storageUid);
+        [$storageId, $objectIdentifier] = array_pad(GeneralUtility::trimExplode(':', $identifier), 2, null);
+        if (!MathUtility::canBeInterpretedAsInteger($storageId) && $objectIdentifier === null) {
+            return $this->storageRepository->findByUid(0);
+        }
+        return $this->storageRepository->findByUid((int)$storageId);
     }
 
     /**
@@ -381,13 +383,19 @@ class ResourceFactory implements SingletonInterface
      */
     public function getObjectFromCombinedIdentifier($identifier)
     {
-        [$storageId, $objectIdentifier] = GeneralUtility::trimExplode(':', $identifier);
-        $storage = $this->storageRepository->findByUid($storageId);
-        if ($storage->hasFile($objectIdentifier)) {
-            return $storage->getFile($objectIdentifier);
+        [$storageId, $objectIdentifier] = array_pad(GeneralUtility::trimExplode(':', $identifier), 2, null);
+        if (!MathUtility::canBeInterpretedAsInteger($storageId) && $objectIdentifier === null) {
+            $objectIdentifier = $storageId;
+            $storageId = 0;
         }
-        if ($storage->hasFolder($objectIdentifier)) {
-            return $storage->getFolder($objectIdentifier);
+        if (MathUtility::canBeInterpretedAsInteger($storageId)) {
+            $storage = $this->storageRepository->findByUid($storageId);
+            if ($storage->hasFile($objectIdentifier)) {
+                return $storage->getFile($objectIdentifier);
+            }
+            if ($storage->hasFolder($objectIdentifier)) {
+                return $storage->getFolder($objectIdentifier);
+            }
         }
         throw new ResourceDoesNotExistException('Object with identifier "' . $identifier . '" does not exist in storage', 1329647780);
     }