Project

General

Profile

Actions

Bug #90063

closed

GeneralUtility::writeFileToTypo3tempDir returns always an error even if the file is written

Added by Rémy DANIEL over 4 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2020-01-07
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
medium
Is Regression:
Sprint Focus:

Description

TYPO3 9 + composer mode

The above code returns always an error, but the file is correctly created:

$filepath = '/var/www/html/web/typo3temp/var/tx_static404/foo.txt';
$error = \TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir($filepath, 'foo');

// $error contains '"/var/www/html/web/typo3temp/var/tx_static404/" was not within directory ProjectPath + var' instead of NULL

The issue is that writeFileToTypo3tempDir checks if the directory of the file is within two allowed pathes:
- Environment::getPublicPath() + "/typo3temp/"
- Environment::getVarPath()

But even if the file is written in the within the first path, the second path is still checked.

The foreach should break as soon as the file is successfully created, and returns NULL error message, as expected.


Files

Actions

Also available in: Atom PDF