seems that php pathinfo function not properly works with UTF file names (prooflink: http://ua.php.net/manual/en/function.pathinfo.php#79980)

For example when I'll try upload files with name "тест.txt" I'll get files with names like "txt", "txt_0" and so on (transliteration module do not fixed this)

attached patch fixes this problem for me.

Comments

internetdevels’s picture

StatusFileSize
new1.19 KB

oops, now added patch that missed in issue :)

fenda’s picture

+1 subscribing

I'd also like this to be fixed!

dave reid’s picture

Note that Drupal 7 (with it's requirement for PHP 5.2) doesn't seem to have this problem. Looks like this was fixed in PHP 5.2.0: https://bugs.php.net/bug.php?id=37945

maximpodorov’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Issue summary: View changes

No. The problem exists, since Drupal 7 sets single-byte locale in bootstrap.inc:
setlocale(LC_ALL, 'C');
I'll make the patch for 7.x-1.x.

maximpodorov’s picture

The patch for 7.x-1.x solves the problem.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

That's why drupal_basename() is introduced!

deciphered’s picture

While in general the fix looks ok, I'm unable to reproduce the issue and I don't like committing patches without first confirming the issue and that the patch fixes the issue.

maximpodorov’s picture

That PHP documentation page shows the example:

print_r(pathinfo("/mnt/files/飛兒樂團光茫.mp3"));

.. will display:

Array
(
[dirname] => /mnt/files
[basename] => .mp3
[extension] => mp3
[filename] =>
)

I confirm that executing this code from Drupal produces the specified result.

deciphered’s picture

@maximpodorov,

Unfortunately that's not helpful, because naming a file '飛兒樂團光茫.txt' or 'тест.txt' works as expected without the patch, which implies that this is actually a non-issue, or that there is something environment specific that hasn't been provided in this issue.

maximpodorov’s picture

Do you mean that $replacements[$original] must be empty for the file 'тест.txt'?

andypost’s picture

@Deciphered that's why we have drupal_basename() in first place
You can't said to all users to upload files with ascii filenames

deciphered’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Postponed (maintainer needs more info)
StatusFileSize
new50.09 KB

@maximpodorov

As you can see below, running the code as you suggested doesn't not cause the issue expected, and as such, there would be no need to apply a patch to fix an issue that doesn't exist:

I don't doubt that the issue does exists, but no one has given me a way to reproduce the issue yet.

What I would suggest is this:
- Fork https://github.com/Decipher/filefield_paths
- Signup to https://travis-ci.org/ (if you haven't already) and add your forked repo
- Add a simpletest that reproduces the issue and fails
- Push that test to your fork
- Ensure that that test also fails on Travis CI
- Send me the link to the fork and the test results in Travis

Alternatively, give me some steps on how i can 100% confirm this issue.

dave reid’s picture

Status: Postponed (maintainer needs more info) » Reviewed & tested by the community
StatusFileSize
new13.98 KB

I can confirm this on my system, Ubuntu 14.04.

deciphered’s picture

@Dave Reid,

Thanks. I suspect it's just a server thing, maybe the versions of PHP I have installed via Homebrew on OS X compensate for it. My concern is that I have not yet seen the issue and as such I don't want to blindly commit the fix.

I'll try it out on a Simplytest.me instance and see if I can reproduce it there.

deciphered’s picture

Ok, issue confirmed, patch confirmed to resolve this issue, I just need to do some additional tests to ensure that the patch doesn't cause any other issues.

  • Deciphered committed 3a0b247 on 7.x-1.x
    #1292436 by maximpodorov, InternetDevels: Fixed issue pathinfo and UTF...
deciphered’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the hard work and patience (or lack there-of if it is so), tests written, failing without the patch as expected and pass with the patch.

Patch committed and pushed.

andypost’s picture

@Deciphered Thanx a lot, now waiting for the next beta ;)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.