36562[BUGFIX] Catch exceptions for inaccessible storages
Commit message
Review
-
Code review CR +2
- Alexander Opitz +2
- Daniel Goerz +1
- Markus Klein +1
- Ingo Schmitt +1
-
Verified V +2
- Alexander Opitz +2
- Markus Klein +1
Issues 1
Files 5
- typo3/sysext/backend/Classes/Utility/IconUtility.php+1 −0
- typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php2+2 −2
- typo3/sysext/core/Classes/Resource/Exception/ResourcePermissionsException.php1new+23 −0
- typo3/sysext/core/Classes/Resource/Folder.php+5 −1
- typo3/sysext/core/Classes/Resource/ResourceStorage.php1+4 −0
Review log 22
-
Philipp Gampe uploaded patch set 1 02/01/15, 10:58
-
Philipp Gampe updated the commit message in patch set 2 02/01/15, 11:00
-
Ingo Schmitt voted on patch set 2 CR +1 02/01/15, 11:14
-
Sascha Egerer commented on patch set 2 CR -1 02/01/15, 11:14
ResourceStorage.php:2491I would add a use for this class to match the upper line. And I'm not sure if we can add a more generic exception here that both can by fetched by one catch. -
Philipp Gampe commented on patch set 2 02/04/15, 17:27
we need to extend from RuntimeException for b/c reasons. -
Benni Mack commented on patch set 2 06/29/15, 19:57
@philipp - this is fixed differently now, right? -
Philipp Gampe commented on patch set 2 07/04/15, 09:36
nope, still happens in master To reproduce: * create a folder nonexisting * create a file inside * add local storage for nonexisting * use the filelist to copy the file into clipboard * rm the folder from disk * reload the filelist * fatal error Uncaught TYPO3 Exception #1319455097: Error while fetching permissions for (More information) RuntimeException thrown in file /home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php in line 1183. 19 TYPO3\CMS\Core\Resource\Driver\LocalDriver::getPermissions("/") /home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/ResourceStorage.php: 00636: 00637: // Check 4: "Folder permissions" of the driver 00638: $folderPermissions = $this->driver->getPermissions($folder->getIdentifier()); 00639: if ($isReadCheck && !$folderPermissions['r']) { 00640: return FALSE; 18 TYPO3\CMS\Core\Resource\ResourceStorage::checkFolderActionPermission("add", TYPO3\CMS\Core\Resource\Folder) /home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/ResourceStorage.php: 02102: throw new \InvalidArgumentException('Parent folder "' . $parentFolder->getIdentifier() . '" does not exist.', 1325689164); 02103: } 02104: if (!$this->checkFolderActionPermission('add', $parentFolder)) { 02105: throw new Exception\InsufficientFolderWritePermissionsException('You are not allowed to create directories in the folder "' . $parentFolder->getIdentifier() . '"', 1323059807); 02106: } 17 TYPO3\CMS\Core\Resource\ResourceStorage::createFolder("_processed_") /home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/ResourceStorage.php: 02630: } else { 02631: if ($this->driver->folderExists($processingFolder) === FALSE) { 02632: $this->processingFolder = $this->createFolder($processingFolder); 02633: } else { 02634: $data = $this->driver->getFolderInfoByIdentifier($processingFolder); 16 TYPO3\CMS\Core\Resource\ResourceStorage::getProcessingFolder() /home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/ResourceStorage.php: 01424: if ($this->processingFolders === NULL) { 01425: $this->processingFolders = array(); 01426: $this->processingFolders[] = $this->getProcessingFolder(); 01427: /** @var $storageRepository StorageRepository */ 01428: $storageRepository = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Resource\StorageRepository::class); 15 TYPO3\CMS\Core\Resource\ResourceStorage::getProcessingFolders() /home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/ResourceStorage.php: 02166: public function isWithinProcessingFolder($identifier) { 02167: $inProcessingFolder = FALSE; 02168: foreach ($this->getProcessingFolders() as $processingFolder) { 02169: if ($this->driver->isWithin($processingFolder->getIdentifier(), $identifier)) { 02170: $inProcessingFolder = TRUE; 14 TYPO3\CMS\Core\Resource\ResourceStorage::isWithinProcessingFolder("/test.txt") /home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/ResourceStorage.php: 01410: public function hasFile($identifier) { 01411: // Allow if identifier is in processing folder 01412: if (!$this->isWithinProcessingFolder($identifier)) { 01413: $this->assureFolderReadPermission(); 01414: } 13 TYPO3\CMS\Core\Resource\ResourceStorage::hasFile("/test.txt") /home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/ResourceFactory.php: 00516: list($storageId, $objectIdentifier) = GeneralUtility::trimExplode(':', $identifier); 00517: $storage = $this->getStorageObject($storageId); 00518: if ($storage->hasFile($objectIdentifier)) { 00519: return $storage->getFile($objectIdentifier); 00520: } elseif ($storage->hasFolder($objectIdentifier)) { 12 TYPO3\CMS\Core\Resource\ResourceFactory::getObjectFromCombinedIdentifier("2:/test.txt") /home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Resource/ResourceFactory.php: 00439: if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($prefix)) { 00440: // path or folder in a valid storageUID 00441: return $this->getObjectFromCombinedIdentifier($input); 00442: } elseif ($prefix == 'EXT') { 00443: $input = GeneralUtility::getFileAbsFileName($input); 11 TYPO3\CMS\Core\Resource\ResourceFactory::retrieveFileOrFolderObject("2:/test.txt") /home/phil/t3-playground/t3-git/typo3/sysext/backend/Classes/Clipboard/Clipboard.php: 00797: } else { 00798: try { 00799: ResourceFactory::getInstance()->retrieveFileOrFolderObject($v); 00800: } catch (\TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException $e) { 00801: // The file has been deleted in the meantime, so just remove it silently 10 TYPO3\CMS\Backend\Clipboard\Clipboard::cleanCurrent() /home/phil/t3-playground/t3-git/typo3/sysext/filelist/Classes/Controller/FileListController.php: 00318: } 00319: $this->filelist->clipObj->setCmd($CB); 00320: $this->filelist->clipObj->cleanCurrent(); 00321: // Saves 00322: $this->filelist->clipObj->endClipboard(); 9 TYPO3\CMS\Filelist\Controller\FileListController::main() /home/phil/t3-playground/t3-git/typo3/sysext/filelist/mod1/index.php: 00018: $GLOBALS['SOBE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Filelist\Controller\FileListController::class); 00019: $GLOBALS['SOBE']->init(); 00020: $GLOBALS['SOBE']->main(); 00021: $GLOBALS['SOBE']->printContent(); 8 require("/home/phil/t3-playground/t3-git/typo3/sysext/filelist/mod1/index.php") /home/phil/t3-playground/t3-git/typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php: 00169: if (file_exists($moduleBasePath . 'index.php')) { 00170: global $SOBE; 00171: require $moduleBasePath . 'index.php'; 00172: return TRUE; 00173: } 7 TYPO3\CMS\Backend\Http\BackendModuleRequestHandler::callTraditionalModule("file_list") /home/phil/t3-playground/t3-git/typo3/sysext/backend/Classes/Http/BackendModuleRequestHandler.php: 00072: $isDispatched = $this->dispatchModule($moduleName); 00073: } else { 00074: $isDispatched = $this->callTraditionalModule($moduleName); 00075: } 00076: if ($isDispatched === FALSE) { 6 TYPO3\CMS\Backend\Http\BackendModuleRequestHandler::handleRequest() /home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Core/Bootstrap.php: 00186: public function handleRequest() { 00187: $requestHandler = $this->resolveRequestHandler(); 00188: $requestHandler->handleRequest(); 00189: return $this; 00190: } 5 TYPO3\CMS\Core\Core\Bootstrap::handleRequest() /home/phil/t3-playground/t3-git/typo3/sysext/core/Classes/Core/Bootstrap.php: 00172: ->unsetReservedGlobalVariables() 00173: ->initializeTypo3DbGlobal() 00174: ->handleRequest(); 00175: 00176: return $this; 4 TYPO3\CMS\Core\Core\Bootstrap::run() /home/phil/t3-playground/t3-git/typo3/sysext/backend/Classes/Http/Application.php: 00075: */ 00076: public function run(callable $execute = NULL) { 00077: $this->bootstrap->run(); 00078: 00079: if ($execute !== NULL) { 3 TYPO3\CMS\Backend\Http\Application::run() /home/phil/t3-playground/t3-git/typo3/mod.php: 00022: call_user_func(function() { 00023: $classLoader = require __DIR__ . '/contrib/vendor/autoload.php'; 00024: (new \TYPO3\CMS\Backend\Http\Application($classLoader))->run(); 00025: }); 2 TYPO3\CMS\Backend\{closure}() 1 call_user_func(Closure) /home/phil/t3-playground/t3-git/typo3/mod.php: 00023: $classLoader = require __DIR__ . '/contrib/vendor/autoload.php'; 00024: (new \TYPO3\CMS\Backend\Http\Application($classLoader))->run(); 00025: }); -
Philipp Gampe uploaded patch set 3 07/04/15, 09:38
-
Philipp Gampe commented on patch set 3 07/04/15, 09:39
rebased, still applies cleanly and fixes the problem -
Philipp Gampe rebased onto patch set 3 07/26/15, 16:15
-
Ingo Schmitt voted on patch set 4 CR +1 07/27/15, 07:58
-
Markus Klein commented on patch set 4 CR -1 07/27/15, 08:35
LocalDriver.php:1177has do to be adjustedLocalDriver.php:1183that's a wrong name! This exception is about a missing read-permission not about failing to read permissions. -
Markus Klein uploaded patch set 5 07/27/15, 08:37
-
Markus Klein voted on patch set 5 CR +1 V +1 07/27/15, 09:08
-
Philipp Gampe commented on patch set 5 07/27/15, 11:54
thanks Markus -
Ingo Schmitt voted on patch set 5 CR +1 07/27/15, 12:03
-
Daniel Goerz voted on patch set 5 CR +1 07/27/15, 13:02
-
Alexander Opitz voted on patch set 5 V +2 CR +2 07/28/15, 08:31
-
Alexander Opitz merged patch set 5 07/28/15, 08:31
-
Alexander Opitz commented on patch set 6 07/28/15, 08:32
Cherry Picked This patchset was cherry picked to branch TYPO3_6-2 as commit 317a06a4f8bf88a8e7ffb4e3d3d3d5543d081c60 -
Helmut Hummel commented on patch set 6 07/28/15, 11:37
post -1 it breaks travis build, and exception hierarchy is "broken"ResourcePermissionsException.php:22That is not the exception hierarchy we strive for. At least for master, we should change that. It should be an exception in the Driver namespace and/or it should clearly state the error that occurred like "PermissionsUnavailableException" or the like -
Daniel Goerz commented on patch set 6 07/28/15, 11:42
> (1 comment) > > post -1 > > it breaks travis build, and exception hierarchy is "broken" Regarding the travis build: there was already a followup: https://review.typo3.org/#/c/42018/
InsufficientFileOrFolderReadPermissionsException.php:23