Bug #32046

function t3lib_div::validPathStr fails on certain file names

Added by Jürgen Tauschl over 10 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2011-11-24
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
4.6
PHP Version:
5.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

File t3lib/class.t3lib_div.php Line 3952 (function validPathStr):

if (strpos($theFile, '//') === FALSE && strpos($theFile, '\\') === FALSE && !preg_match('#(?:^\.\.|/\.\./|[[:cntrl:]])#', $theFile)) {
    return TRUE;
}

The [[:cntrl:]] part of the search pattern matches on certain German umlauts (Ü, ß). The result is that certain files won't be shown.

Problem exists also in 4.5(.6).


Files

test-32046.php (232 Bytes) test-32046.php Dmitry Dulepov, 2011-12-02 14:20
#1

Updated by Dmitry Dulepov over 10 years ago

  • Status changed from New to Accepted
  • Assignee set to Dmitry Dulepov

It also fails on any cyrillic letters. Thus it is not possible to have UTF-8 file names from t3lib_div::getFileGetAbsFileName().

#2

Updated by Helmut Hummel over 10 years ago

Dmitry Dulepov wrote:

It also fails on any cyrillic letters. Thus it is not possible to have UTF-8 file names from t3lib_div::getFileGetAbsFileName().

What are the exact letter that match the query?

I tried this:

$theFile='asdasäöüÄÖÜßАБВГДЕЖЅЗИІКЛМНОПҀРСТѸФХѠЦЧШЩЪꙐЬѢꙖѤЮѦѪѨѬѮѰѲѴ';
var_dump(preg_match('#(?:^\.\.|/\.\./|[[:cntrl:]])#', $theFile));

But the result is "int 0"

Maybe it depends on the PHP version or if zend multibyte is used?
Maybe adding the "u" modifier already helps on your side?

$theFile='asdasäöüÄÖÜßАБВГДЕЖЅЗИІКЛМНОПҀРСТѸФХѠЦЧШЩЪꙐЬѢꙖѤЮѦѪѨѬѮѰѲѴ';
var_dump(preg_match('#(?:^\.\.|/\.\./|[[:cntrl:]])#u', $theFile));
#3

Updated by Dmitry Dulepov over 10 years ago

I attached a test file. Please, put it into the root of any TYPO3 installation and run. The result will be:

t3lib_div::validPathStr('fileadmin/templates/Ссылки (fce).xml') returns false

Expected result is:

t3lib_div::validPathStr('fileadmin/templates/Ссылки (fce).xml') returns true
#4

Updated by Dmitry Dulepov over 10 years ago

'u' modifier helps.

#5

Updated by Gerrit Code Review over 10 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7032

#6

Updated by Gerrit Code Review over 10 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7032

#7

Updated by Gerrit Code Review over 10 years ago

Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/7032

#8

Updated by Gerrit Code Review over 10 years ago

Patch set 1 for branch TYPO3_4-5 has been pushed to the review server.
It is available at http://review.typo3.org/7796

#9

Updated by Gerrit Code Review over 10 years ago

Patch set 1 for branch TYPO3_4-6 has been pushed to the review server.
It is available at http://review.typo3.org/7797

#10

Updated by Dmitry Dulepov over 10 years ago

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

Updated by Benni Mack almost 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF