Bug #54750

Wrong use of tempnam() in LocalPrieviewHelper

Added by Frans Saris almost 6 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
File Abstraction Layer (FAL)
Target version:
Start date:
2014-01-05
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

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.

Associated revisions

Revision 447dba14 (diff)
Added by Frans Saris almost 6 years ago

[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.

Releases: 6.2
Resolves: #54750
Change-Id: I19383bc8f6b387133bff2f4033f05b28e883d427
Reviewed-on: https://review.typo3.org/26650
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
Reviewed-by: Markus Klein
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter

History

#1 Updated by Gerrit Code Review almost 6 years ago

  • Status changed from New 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 https://review.typo3.org/26650

#2 Updated by Gerrit Code Review almost 6 years ago

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

#3 Updated by Gerrit Code Review almost 6 years ago

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

#4 Updated by Gerrit Code Review almost 6 years ago

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

#5 Updated by Gerrit Code Review almost 6 years ago

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

#6 Updated by Gerrit Code Review almost 6 years ago

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

#7 Updated by Gerrit Code Review almost 6 years ago

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

#8 Updated by Frans Saris almost 6 years ago

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

#9 Updated by Riccardo De Contardi about 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF