Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1460846

    Nach Installation der gerade veröffentlichten Enfold-Version 6.0 wird bei dem Versuch, den “Theme-Datei-Editor” zu starten,
    folgender WordPress-Fehler angezeigt
    “Diese Datei kann leider nicht bearbeitet werden.”

    Als unbefriedigende Zwischenlösung muss manuell in der Datei “../wp-includes/functions.php” die Zeile
    “$file = wp_normalize_path( $file );”
    entfernt oder auskommentiert werden.

    Dieser manuelle Eingriff sollte vermieden werden, d. h.
    die Software des Enfold-Themes muss korrigiert werden, damit der Fehler nicht mehr auftritt!

    #1460862

    Hey OlafThomsen,

    I can’t reproduce this problem on a test installation, could you tell us which steps you are taking for this to happen please?

    Best regards,
    Rikard

    #1461118

    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!

    #1461161

    Hi,

    Thank you for the info.

    We can’t reproduce the same issue on our local installation. This might be something unique to your local setup. Have you tried using a different local server?

    Best regards,
    Ismael

    #1461240

    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.

    #1461276

    Hi,

    Thank you for the info.

    Could you please provide the complete error message? Since it’s occurring only in your local installation, it’s possible that the issue is related to your operating system, the local server setup, or how your machine is configured.

    Best regards,
    Ismael

    #1461378

    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>

    #1461420

    Hi,

    Thank you for the info.

    Have you tried activating a default theme to see if you can use the Theme File Editor when Enfold is not activated? It’s a bit difficult for us to determine the issue since we can’t reproduce it on our own installation.

    Best regards,
    Ismael

    #1461439

    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

    #1461448

    Hi,

    Great, I’m glad that you found a solution for your problem, and thanks for sharing. Please let us know if you should need any further help on the topic, or if we can close it.

    Best regards,
    Rikard

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.