View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
14091 | Bug reports | Survey taking | public | 2018-09-24 16:21 | 2023-05-29 11:13 |
Reporter | tbart | Assigned To | c_schmitz | ||
Priority | high | Severity | minor | ||
Status | closed | Resolution | reopened | ||
Product Version | 3.13.x | ||||
Summary | 14091: Filenames of uploads starting with special characters truncated with invalid setlocale | ||||
Description | Non-ANSI characters (e.g. umlauts (äöü) ) at the beginning of uploaded files are cut off. | ||||
Steps To Reproduce | When taking a survey that contains a file upload field:
| ||||
Additional Information | This is due to locale-awareness of PHP's basename(). Adding setlocale(LC_ALL, 'en_US.UTF8'); in index.php fixes it, but I am sure this is not the right place to add this. My system locale (on debian) is correctly set (apart from LC_ALL, which normally is just an override and should not be set). Please either respect system's LANG or set the locale to some UTF-8 compatible one. | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Bug heat | 20 | ||||
Complete LimeSurvey version number (& build) | 3.27.23 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | |||||
Database type & version | mySQL 5.5.60 | ||||
Server OS (if known) | debian | ||||
Webserver software & version (if known) | apache 2.4.10 or nginx | ||||
PHP Version | 5.6.36 or 7.4.25 | ||||
related to | 17718 | closed | c_schmitz | sanitize_filename didn't really fix filename for all system |
has duplicate | 18844 | new | In file upload question, file names are obtained incorrectly, if file name starts with double-byte characters. | |
related to | 18432 | closed | gabrieljenik | Can't upload and view files with Hebrew names |
yes we have hard filtering of file names for security reason. |
|
I understand file names get filtered, but this does not seem related. Why does setting the correct locale circumvent the filtering? But I may be wrong. If only ASCII (or even a more reduced subset) is allowed, a note should advise users to rename their files (and only list allowed characters). Though this seems pretty uncommon. There should be standard functions to sanitize the string and frankly, umlauts don't seem all too dangerous :) |
|
«yes we have hard filtering of file names for security reason. » ??? Filtering äöü have nothing with security , andis not filtered like this in 'Upload question' type. @tbart : where it's filtered like this ? And what is the broken locale |
|
Your filenames do not start with special characters. See screenshot attached. The locale should be en_US.UTF-8, at least that's what the environment sets for LANG: set | egrep "^(LANG|LC)"LANG=en_US.UTF-8 |
|
My filename was äöü.png ;) , but my locale is OK. Can show your current locale in PHP ? |
|
Sorry, I misread your screenshot and thought the left column were the filenames, my bad. phpinfo() gives me: It's still strange why only umlauts at the beginning get stripped off. This should not be locale dependent! |
|
Please update to the latest version and check if the bug can still be reproduced. Thank you. |
|
I can confirm this is still broken in Version 3.25.17+210309. Adding setlocale(LC_ALL, 'en_US.UTF8'); in index.php still fixes it. |
|
@ollehar did this need a fix here ? Else : simple fix :
I don't have way to reproduce : need to broke my PHP ;) |
|
@tbart : can you check with ONLY setlocale(LC_CTYPE, 'en_US.UTF8'); ? |
|
Way to reproduce : config.php : setlocale(LC_CTYPE,"C"); Must check if i can fix without setlocale (f**king crosoft and unsure en.utf8 exist). |
|
LC_TYPE to C $filename = österreich.png |
|
|
|
This is on a Debian and/or Ubuntu server. So
(with 3 closing brackets :-) ) is not true, so this does not help.
alone does help as well. On a not so unrelated sidenote: However, as Debian/Ubuntu(/most likely all other Debian based distros) - which will make up a huge percentage of all limesurvey installations I guess - set "C" as their default domain, some fix needs to be devised. How is your/everyone else's server setup so it seems it does not use "C" as a default locale? What I still don't get is why utf-8 characters in the middle of a filename work with the "C" locale and those at the beginning don't. This really seems like a limesurvey bug, still. |
|
Oups, link with pull request not done |
|
Discussion ongoing in github |
|
Add related : 17718: sanitize_filename didn't really fix filename for all system |
|
My patch for 17718 only fixes it for version 5. |
|
Fixed in 5. |
|
Date Modified | Username | Field | Change |
---|---|---|---|
2018-09-24 16:21 | tbart | New Issue | |
2019-01-10 17:40 |
|
Assigned To | => LouisGac |
2019-01-10 17:40 |
|
Status | new => closed |
2019-01-10 17:40 |
|
Resolution | open => no change required |
2019-01-10 17:40 |
|
Note Added: 50169 | |
2019-01-14 17:40 | tbart | Note Added: 50188 | |
2019-01-15 08:40 | DenisChenu | Status | closed => feedback |
2019-01-15 08:40 | DenisChenu | Resolution | no change required => reopened |
2019-01-15 08:40 | DenisChenu | Note Added: 50192 | |
2019-01-15 08:40 | DenisChenu | File Added: Capture d’écran du 2019-01-15 08-40-13.png | |
2019-01-15 08:51 | DenisChenu | Note Edited: 50192 | |
2019-01-15 09:06 | tbart | File Added: umlauts_at_the_beginning_cut_off.png | |
2019-01-15 09:06 | tbart | Note Added: 50194 | |
2019-01-15 09:06 | tbart | Status | feedback => assigned |
2019-01-15 10:00 | DenisChenu | Note Added: 50205 | |
2019-01-15 10:37 | tbart | Note Added: 50207 | |
2021-03-10 22:43 | ollehar | Assigned To | LouisGac => |
2021-03-10 22:43 | ollehar | Status | assigned => feedback |
2021-03-10 22:43 | ollehar | Note Added: 63212 | |
2021-03-11 10:40 | tbart | Note Added: 63290 | |
2021-03-11 10:40 | tbart | File Added: limesurvey_survey_185162.lss | |
2021-03-11 10:40 | tbart | File Added: österreich.png | |
2021-03-11 10:40 | tbart | Status | feedback => new |
2021-03-11 11:38 | ollehar | Priority | none => high |
2021-10-07 14:09 | ollehar | Zoho Project Synchronization | => |Yes| |
2021-10-07 14:11 | ollehar | Assigned To | => ollehar |
2021-10-07 14:11 | ollehar | Status | new => acknowledged |
2021-11-04 12:10 | DenisChenu | Assigned To | ollehar => DenisChenu |
2021-11-04 12:14 | DenisChenu | Note Added: 67112 | |
2021-11-04 12:18 | DenisChenu | Note Added: 67113 | |
2021-11-04 15:41 | DenisChenu | Note Added: 67116 | |
2021-11-04 15:42 | DenisChenu | Status | acknowledged => confirmed |
2021-11-04 15:42 | DenisChenu | Complete LimeSurvey version number (& build) | 3.14.9+180917 => 3.27.23 |
2021-11-04 15:43 | DenisChenu | Summary | Filenames of uploads starting with special characters truncated => Filenames of uploads starting with special characters truncated with invalid setlocale |
2021-11-04 15:43 | DenisChenu | Webserver software & version (if known) | apache 2.4.10 => apache 2.4.10 or nginx |
2021-11-04 15:43 | DenisChenu | PHP Version | 5.6.36 => 5.6.36 or 7.4.25 |
2021-11-04 15:43 | DenisChenu | Zoho Project Synchronization | Yes => |Yes| |
2021-11-04 15:47 | DenisChenu | Note Added: 67118 | |
2021-11-04 15:48 | DenisChenu | Note Added: 67119 | |
2021-11-10 11:23 | tbart | Note Added: 67219 | |
2021-11-10 12:00 | DenisChenu | Note Added: 67226 | |
2021-11-12 10:44 | galads | Note Added: 67273 | |
2021-11-12 10:44 | galads | Bug heat | 8 => 10 |
2021-11-12 10:45 | DenisChenu | Relationship added | related to 17718 |
2021-11-12 10:45 | DenisChenu | Note Added: 67274 | |
2022-02-04 08:34 | DenisChenu | Assigned To | DenisChenu => c_schmitz |
2022-02-05 19:56 | c_schmitz | Note Added: 68214 | |
2022-02-05 19:56 | c_schmitz | Bug heat | 10 => 12 |
2022-02-05 19:57 | c_schmitz | Note Edited: 68214 | |
2022-02-05 19:59 | c_schmitz | Note Edited: 68214 | |
2022-03-31 11:45 | galads | Zoho Project Synchronization | Yes => |
2022-09-27 13:21 | DenisChenu | Status | confirmed => closed |
2022-09-27 13:21 | DenisChenu | Note Added: 71970 | |
2022-10-26 10:01 | DenisChenu | Relationship added | related to 18432 |
2023-05-29 11:13 | DenisChenu | Relationship added | has duplicate 18844 |
2023-05-29 11:13 | DenisChenu | Bug heat | 12 => 20 |