Project

General

Profile

Actions

Bug #69358

closed

strtolower() breaks German Umlaute in File Pathes

Added by Sebastian Mazza about 9 years ago. Updated about 6 years ago.

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

100%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.6
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

The method canonicalizeAndCheckFileIdentifier($fileIdentifier) in sysext/core/Classes/Resource/Driver/AbstractHierarchicalFilesystemDriver.php uses the php function strtolower() which corrupts multibyte characters.

Test: call TYPO3\CMS\Core\Resource\File->getForLocalProcessing(false) for a File with german Umlaut (ä, ö, ü)

Fix: change the line 63 in sysext/core/Classes/Resource/Driver/AbstractHierarchicalFilesystemDriver.php
from: $fileIdentifier = strtolower($fileIdentifier);
to: $fileIdentifier = mb_strtolower($fileIdentifier);

/**
     * Makes sure the Path given as parameter is valid
     *
     * @param string $fileIdentifier The file path (including the file name!)
     * @return string
     * @throws \TYPO3\CMS\Core\Resource\Exception\InvalidPathException
     */
    protected function canonicalizeAndCheckFileIdentifier($fileIdentifier) {
        if ($fileIdentifier !== '') {
            $fileIdentifier = $this->canonicalizeAndCheckFilePath($fileIdentifier);
            $fileIdentifier = '/' . ltrim($fileIdentifier, '/');
            if (!$this->isCaseSensitiveFileSystem()) {
                //$fileIdentifier = strtolower($fileIdentifier); 
                $fileIdentifier = mb_strtolower($fileIdentifier); // fix by Sebastian
            }
        }
        return $fileIdentifier;
    }

Actions

Also available in: Atom PDF