Forum Replies Created

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • Hello Ismael,

    sometimes I can’t see the wood for the trees. By telling me to test with other themes, you have shown me the wood:

    The error also occurs with other themes because the files to be validated are normalized (“\” replaced by “/”),
    but the allowed files, on the other hand, are not normalized.

    There is a patch for this problem on the following website:
    https://src.isharkfly.com/WordPress-C/WordPress/commit/9da0418c4165b0a0f579d2569c5bb19a4331a6f0

    I hope that the bug will be fixed with the next WordPress version.

    Many thanks for your support

    All the results I published on this forum until yesterday are from an installation (Windows11 Pro, XAMPP 8.2.12 (german), WordPress 6.5.5 (german), Enfold 6.0) on my notebook.

    Today I have installed from cratch the freshly downloaded bare software XAMPP 8.2.12 (german), WordPress 6.5.5 (german), Enfold 6.0
    on my PC (Windows10 Pro) and added only the following settings
    – Creation of the required MySQL table (without further manual import)
    – Connection to the table in the MySQL database via wp-config.php
    – Only settings needed for WordPress to be started
    – Setup up the “enfold-child” folder (after downloading from kriesi.at)
    – Activation of the child theme.
    Even with this very minimal installation, opening files (e.g. style.css from the enfold-child folder) via the theme-file-editor will abort with the error message “Diese Datei kann leider nicht bearbeitet werden” (Sorry, this file could not be opened) because aof the backslashes in the absolute path.
    I cannot believe, that a wrong setup causes the error.

    Note what the Firefox-Inspector shows:
    <html class=” xwaotx idc0_350″ lang=”de_DE”>
    <head></head>
    <body id=”error-page”>
    file to normalize: D:\xamp\htdocs\website-name/wp-content/themes/enfold-child/style.css
    (this line is shown due to a manually added echo in wp-includes/functions.php, error also occurs without this echo)
    <br>
    <meta http-equiv=”Content-Type” content=”text/thml; charet=UTF-8″>
    <meta name=”viewport” content=”width=device-width”>
    <meta name=”robots” content=”noindex, nofollow”>
    <style type=”text/css”>…</style>
    <div class=”wp-die-message”>Diese Darei kann leider nicht bearbeitet werden.</div>
    </body>
    </html>

    I did some further investigation and found that in “theme-editor.php” the absolute path of “$file” contains backslashes,
    for example
    “D:\xampp\htdocs\website-name/wp-content/themes/enfold-child/style.css”.
    The backslashes cause the error reported by
    “$file = wp_normalize_path( $file );”.
    Replacing the backslashes by normal slashes in “theme-editor.php” like this
    “$allowed_files[‘style.css’] = str_replace(‘\\’, ‘/’, $style_files[‘style.css’]);”
    can avoid the error.
    Manual patching is unsatisfactory, but I did not find any other solution to the problem.
    Note:
    Surprisingly, the plugin-file-editor does not have this problem, because only relative paths are used, not absolute ones.
    May be the (WordPress-/)Theme developers could take a look at this and adopt that solution.

    As I maintain two different websites, I usually test changes and new software versions in a “localhost environment” (currently Windows 11, XAMPP 8.2.12, WordPress 6.5.5) before installing them on the external servers.

    The bad news:
    In the “localhost environment”, the following test conditions always lead to the Theme Editor error:
    – Uploading Enfold version 6.0 via WordPress -> Design -> Themes -> Add new theme -> enfold.zip
    – Copy the folder “enfold” (version 6.0) directly into the directory “../wp-content/themes”.
    – Using Firefox
    – Using Chrome
    – All plugins disabled

    The good news:
    After installing Enfold version 6.0 on the external servers, the error does not occur,
    even though the file “../wp-includes/functions.php” on the external servers also contains the code
    // Normalising the path for Windows servers
    $file = wp_normalize_path( $file );
    Note: This code was introduced with the current WordPress version 6.5.5!

Viewing 4 posts - 1 through 4 (of 4 total)