Bug #32046
closed
function t3lib_div::validPathStr fails on certain file names
Added by Jürgen Tauschl about 13 years ago.
Updated about 6 years ago.
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
- 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().
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));
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
- Status changed from Accepted to Under Review
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF