• Hello,
    I’ve found a bug in the plugin related to file names.
    For example, if a file contains Cyrillic characters, they will be ignored.
    For instance:
    "вал?за.jpg" => ".jpg" (This leads to the error "file name or extension is missing" because in this case, the function cannot find the name in the string.)
    "чорна-вал?за.jpg" => "-вал?за.jpg" (When you try to change the file name and save the new name, you get the error "The media containing directory is not writable!" because the plugin cannot find a file with such a name, probably because it doesn't exist.)
    "black-вал?за.jpg" => "black-вал?за.jpg" (In this case, the plugin works correctly.)

    The reason for this issue is the PHP function “basename.” The problem arises because it depends on “setlocale,” and if the “locale” is not explicitly defined on the server, it will work incorrectly.

    As far as I can see, the “basename” function is only used in the “classes/class-lib.php” file in your plugin’s code.
    The simplest way to fix the bug is to add this method:

    public static function basename_safe($path) {
    $path = rtrim($path, '/');
    $path = explode('/', $path);
    return end($path);
    }

    And then replace basename() with self::basename_safe().

    If possible, please apply this change to the plugin and upload a new version of it.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author crossi72

    (@crossi72)

    Hi @ivaskivroman,
    I’ll check the fix you proposed as soon as possible and release a new version.

    Thank you for suggesting the fix!
    C.

    Plugin Author crossi72

    (@crossi72)

    Hi @ivaskivroman,
    I implemented a safe version of basename_safe , but I tested the issue on my development and live servers and everything is working even with the old version of Phoenix Media Rename, so it is hard to tell if the problem is fixed with the new version.

    Can you try the new version on your server to see if now the plugin works even on non-latin characters?

    You can find the version to test here: https://www.eurosoftlab.com/lab/pmr.zip

    Thank you
    C.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bug in the plugin related to file names’ is closed to new replies.