Bug #88163

InvalidArgumentException on uploading file starting with umlauts

Added by Stephan Großberndt 6 months ago. Updated 9 days ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
File Abstraction Layer (FAL)
Target version:
-
Start date:
2019-04-17
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Yes
Sprint Focus:

Description

If you upload a file starting with an umlaut, e.g.

"ällgemeines Döküment.txt"

to a TYPO3 instance using UTF8filesystem = true this leads to an error although the file was uploaded

Error after uploading the file

and an exception on accessing the folder the file was uploaded to

Exception on accessing the folder containing the file

This seems to be the case due to TYPO3 stripping the leading umlauts when processing the file for FAL but keeping them in the uploaded file stored in the folder.

error_after_upload.png View - Error after uploading the file (40.2 KB) Stephan Großberndt, 2019-04-17 11:29

exception_folder_access.png View - Exception on accessing the folder containing the file (92.5 KB) Stephan Großberndt, 2019-04-17 11:30

screenshot.png View (4.72 KB) Frans Saris, 2019-04-17 17:00


Related issues

Related to TYPO3 Core - Task #89351: Warn in [SYS][UTF8filesystem] that a valid UTF-8 locale is necessary Resolved 2019-10-05

History

#1 Updated by Frans Saris 6 months ago

For me it doesn't break in TYPO3 8 but in TYPO3 9 it does

#2 Updated by Frans Saris 6 months ago

if you look at the stacktrace you see that de fileIndentifier is somewhere trimmed. The first char is removed

#3 Updated by Stephan Großberndt 6 months ago

  • Is Regression set to Yes

#4 Updated by Christian Eßl 14 days ago

  • Is Regression changed from Yes to No

The problem lies in PHPs function basename() which is used in the PathUtility:

public static function basename($path)
    {
        $currentLocale = setlocale(LC_CTYPE, 0);
        setlocale(LC_CTYPE, $GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale']);
        $basename = basename($path);
        setlocale(LC_CTYPE, $currentLocale);
        return $basename;
    }

If your locale is not set to UTF-8, basename() will return an empty string on filenames that start with an umlaut.
To fix this behaviour, set your systemLocale in TYPO3 to some string with UTF-8.

Example:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale'] = 'en_US.UTF-8';

#5 Updated by Christian Eßl 14 days ago

  • Related to Task #89351: Warn in [SYS][UTF8filesystem] that a valid UTF-8 locale is necessary added

#6 Updated by Stephan Großberndt 10 days ago

  • Status changed from New to Needs Feedback
  • Is Regression changed from No to Yes

I reported it for TYPO3 9.5.5 - now I tested again on a TYPO3 8.7.27 and TYPO3 9.5.9

Both have (and had) the same settings:

$GLOBALS['TYPO3_CONF_VARS']['SYS']['UTF8filesystem] = true;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['systemLocale'] = 'de_DE.UTF-8';

I can no longer reproduce the issue, maybe it was solved in between? Frans, could you please confirm the issue is no longer there for you too?

#7 Updated by Frans Saris 9 days ago

For me this wasn't a problem

#8 Updated by Stephan Großberndt 9 days ago

  • Status changed from Needs Feedback to Closed

Also available in: Atom PDF