Project

General

Profile

Actions

Bug #65673

closed

"0" is not accepted as a valid file name

Added by Malte Muth about 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
Start date:
2015-03-11
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.5
Tags:
Complexity:
no-brainer
Is Regression:
No
Sprint Focus:

Description

After sanitizing a filename in LocalDriver, the result $cleanFilename is checked for ... any surviving characters, I guess?

Line 320-325, typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php:

if (!$cleanFileName) {
    throw new \TYPO3\CMS\Core\Resource\Exception\InvalidFileNameException(
        'File name ' . $cleanFileName . ' is invalid.',
        1320288991
    );
}

The purpose of the error message is not quite clear; either $cleanFileName is empty since the file name did not contain any valid characters to begin with, or it is NULL as a return value of preg_replace when the function encountered an error.

The check, however, catches any file name that evaluates to false after coercion (although the file name is perfectly valid).

Without any deeper understanding, I propose to change the condition to

if (is_null($cleanFileName) || empty($cleanFileName)) {

Discuss!

Actions

Also available in: Atom PDF