• Resolved pablosoengas

    (@pablosoengas)


    While checking the error_log file of a website, I have found a bug in the source code of this plugin:
    [16-May-2024 19:25:28 UTC] PHP Warning: require(/home/rightsan/rr.bracketserver.com/wp-content/plugins/media-file-renamer/classes/admin.php): Failed to open stream: No such file or directory in /home/rightsan/rr.bracketserver.com/wp-content/plugins/media-file-renamer/classes/init.php on line 32

    The code in question is this:

    if ( $file ) {
    if ( !$necessary && !file_exists( $file ) ) {
    return;
    }
    require( $file );

    I think the second if statement is wrong.
    It should be as follows:
    if ( !$necessary || !file_exists( $file ) ) {

    because as it is right now, if $necessary is set to true, it will try to open the file although the file doesn’t exist, causing the aforementioned warning

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Support Val Meow

    (@valwa)

    Hey @pablosoengas! ??

    Actually, the file_exists check should be done regardless of $necessary since, in any case, if the file is not accessible, it should not be used. However, if we perform this check, the $necessary variable is only used to determine whether to return early if the file doesn’t exist. This can be simplified by removing the $necessary variable and directly checking file_exists.

    So simply using the code below should be enough. We will make sure to correct this on our side. Thanks!

    if ( $file && file_exists( $file ) ) {
        require( $file );
      }
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.