Bug #55833

Creation of typo3temp/_processed_/ required write access to root folder

Added by Alexander Stehlik over 7 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Should have
Category:
File Abstraction Layer (FAL)
Target version:
Start date:
2014-02-10
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
medium
Is Regression:
No
Sprint Focus:

Description

Steps to reproduce:

  1. Use an image file in you template that comes from the fallback storage (which uses typo3temp/_processed_/ as processing folder)
  2. make sure the imge gets resized (e.g. by setting the width property)
  3. Prevent write access for the Webserver to the TYPO3 root folder, but allow write access to typo3temp/
  4. Open the Frontend

You will get an Exception:

#1323059807: You are not allowed to create directories in the folder "/"

The problem occurs during this call:

TYPO3\CMS\Core\Resource\ResourceStorage::createFolder("typo3temp/_processed_/")

Even if the typo3temp/ folder exists the ResourceStorage will check if the root directory is writable.

I would suggest to add a new createFolderRecursive method, which accepts an array of folder names that are created recursively. This would allow a permission check for every directory in the path, but only if the directory does not exist already.


Related issues

Related to TYPO3 Core - Bug #56388: _preocessed_ not using fileCreateMaskClosed2014-02-27

Actions
#1

Updated by Steffen Ritter over 7 years ago

  • Target version deleted (6.2.0)
#2

Updated by Christian Weiske over 7 years ago

-This problem affects the vidi extension (and thus the media mangement extension) which is not able to create typo3temp/_processed_ anymore in 6.2. -

#3

Updated by Sebastian Fischer over 7 years ago

Should the folder processed realy get created in typo3temp? The folder already exists in fileadmin. Cant this folder be used?

#4

Updated by Guido Palacios over 7 years ago

Hello,

i don't know if this is the right place for posting following hint...

But in my case (Upgrade from 4.6 to 4.7 and then 4.7 to 6.2) clicking the fileadmin shows this error... The same when i try to select an image (in the occurring popup) via normal Image CE.

After several "comment-out" tries (Patch 1-4) in /Core/Classes/Resource/ResourceStorage.php nothing helped. Later i figured out that the problem was wrongly merged Database/File Mounts. They wasn't configured "relative" and the target was "/" and not "fileadmin/".

After changing this, the resource error doesn't appear anymore. the strange thing is - it's a windows xampp dev env.

Could this be a solution or do i don't understand the Bug-Report again?!

Cheers and best regards
Guido

Alexander Stehlik wrote:

Steps to reproduce:

  1. Use an image file in you template that comes from the fallback storage (which uses typo3temp/_processed_/ as processing folder)
  2. make sure the imge gets resized (e.g. by setting the width property)
  3. Prevent write access for the Webserver to the TYPO3 root folder, but allow write access to typo3temp/
  4. Open the Frontend

You will get an Exception:

#1323059807: You are not allowed to create directories in the folder "/"

The problem occurs during this call:

[...]

Even if the typo3temp/ folder exists the ResourceStorage will check if the root directory is writable.

I would suggest to add a new createFolderRecursive method, which accepts an array of folder names that are created recursively. This would allow a permission check for every directory in the path, but only if the directory does not exist already.

#5

Updated by Christian Weiske about 7 years ago

This problem also happens with "Help > About modules" and "Help > About TYPO3 CMS".

#6

Updated by Bernhard Kraft about 7 years ago

This issue boils down to one of the new concepts in 6.2:

  • New TYPO3 version don't assume that "typo3temp" must exist. If it doesn't it will create it.
  • Therefore newer TYPO3 versions must have write permissions to the webroot "/" where typo3temp resides in.

Of course it sounds logically that it should also work when typo3temp/ has been manually created. But it currently doesn't because of an issue in ResourceStorage.php

The solution would be to fix method "checkFolderActionPermission" in ResourceStorage.php

In fact this method seems to be incomplete for its purpose. Besides the $action parameter it only gets one other parameter "$folder". But for many operations like "copy" or "move" and also "add" two parameters should be required: The source and the target. In the case of "add" both parameters could get concatenated and then traversed backwards to find the first non-existing folder. Those parent folder would have to be writable.

#7

Updated by Bernhard Kraft about 7 years ago

The method "createFolder" is thus used in a way that it must be able to handle recursive creation of folders. If typo3temp doesn't exists, createFolders would be responsible for recursively creating it.

For this purpose it would be necessary to operate on the parts of a folder path. So I assume there is a method "splitPath" missing for the drivers.

Files in a filesystem tend to be organized in folders and files. A file can get specified by a path. So there needs to be a way to split up a path into its particles: instances of "Folder" and "File" in the case of FAL.

#8

Updated by Adrien Crivelli almost 7 years ago

Agree with Bernhard Kraft. It should find the first existing parent and check their rights instead of the root folder.

In my case we have a custom script deleting all files in typo3temp/, but not the folder itself. After this operation TYPO3 fails to re-create typo3temp/_processed_/ because it does not have rights on typo3temp parent, which actually has nothing to do with the creation of typo3temp subfolders.

#9

Updated by Mathias Schreiber almost 7 years ago

  • Target version set to 7.1 (Cleanup)
  • Sprint Focus set to On Location Sprint
#10

Updated by Ingo Schmitt over 6 years ago

  • Status changed from New to In Progress
  • Assignee set to Roman Schürmann
#11

Updated by Gerrit Code Review over 6 years ago

  • Status changed from In Progress to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36557

#12

Updated by Gerrit Code Review over 6 years ago

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36560

#13

Updated by Sebastian Fischer over 6 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#14

Updated by Gerrit Code Review over 6 years ago

  • Status changed from Resolved to Under Review

Patch set 2 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/36560

#15

Updated by Sebastian Fischer over 6 years ago

  • Status changed from Under Review to Resolved
#16

Updated by Anja Leichsenring almost 6 years ago

  • Sprint Focus deleted (On Location Sprint)
#17

Updated by Riccardo De Contardi almost 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF