Wrong use of tempnam() in LocalPrieviewHelper
In TYPO3\CMS\Core\Resource\Processing\LocalPrieviewHelper Utility\GeneralUtility::tempnam() is used to create a temp file.
$temporaryFileName = Utility\GeneralUtility::tempnam('preview_') . '.' . $task->getTargetFileExtension();
The problem here is that tempnam() creates a file int typo3temp but that one isn't used because the file extension is added to the $temporyFileName.
This results in a empty file in typo3temp every time an processed file is created.
[BUGFIX] Add fileSuffix option to GeneralUtility::tempnam()
Currently it is only possible to create a
temporary file with a given prefix and without
any file extension. But for some use-cases you
need a file with a certain file extension.
This patch introduces a new optional parameter to
GeneralUtility::tempnam() to make it possible to add
e.g. a specific extension to the created file.
In addition the occurrences in core, which can benefit
from this, are adapted resulting in less orphaned
temporary files in typo3temp.
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
Reviewed-by: Markus Klein
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter