• Resolved nufocusuk

    (@nufocusuk)


    I recently updated NextGenGallery plugin to version 3.55 and started getting error messages in plugins/nextgen-gallery/src/Display/View.php indicating that the template could not be found. Basically the code was constructing an absolute pathname by prefixing the template name with a path that already existed in the template similar to this (D:\Home\ApacheRoot\workshop\httpdocs\wp-content\plugins\nextgen-gallery\templates\D:\Home\ApacheRoot\workshop\httpdocs\wp-content\plugins\nextgen-gallery…)

    The error occurred in the find_template_abspath() function, but the root cause occurs in function get_template_abspath() on thw first line below:

    if ( 0 === strpos( $template, DIRECTORY_SEPARATOR ) ) {
            // $value is an absolute path, but it must be validated first
            if ( ! $this->is_valid_template_filename( $template ) || ! @file_exists( $template ) ) {
                $display_name = esc_html( $template );
                throw new \RuntimeException( esc_html( $display_name ) . ' is not a valid MVC template' );
            }
        } else {
            $template = $this->find_template_abspath( $template, $legacy_template_path );
        }

    The assumption is that the first character being a DIRECTORY_SEPARATOR (ie. /) indicates an absolute path is only true for linux… on Windows the path could start with a driver letter and colon (e.g. D:) and so you should also test for either / first or : colon in the path.

    The wrong assumption means the find_template_abspath() is called instead of is_valid_template_filename().

    There is also a secondary isse in the find_template_abspath() function where .php is prefixed to the template/legacy template name, but there is no test to determine if the template already includes .php and so template names with .php.php can be created. The use of rtrim($legacy, ‘.php’) before adding the .php suffix would resolve this problem.

    Please can you update the plugin to handle operation on Windows as these assumptions may cause other functionality to fail.

    • This topic was modified 1 year, 2 months ago by nufocusuk.
    • This topic was modified 1 year, 2 months ago by nufocusuk.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Mihai Ceban

    (@mihaiimagely)

    Hi @nufocusuk,

    Sorry for the path related problem. Could you please update to NextGen Gallery 3.57 to see if that’ll resolve the issue?

    Plugin Support Mihai Ceban

    (@mihaiimagely)

    Hi @nufocusuk,

    We haven’t heard back from you in a few days, so I’m going to go ahead and close this thread for now. But if you’d like us to assist further, please feel welcome to continue the conversation (please just see my post above).

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Next Gen 3.55 problem on Windows Server’ is closed to new replies.