-
AuthorPosts
-
July 1, 2024 at 9:17 pm #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!July 1, 2024 at 11:05 pm #1460862Hey 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,
RikardJuly 2, 2024 at 10:12 pm #1461118As 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 disabledThe 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!July 3, 2024 at 7:19 am #1461161Hi,
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,
IsmaelJuly 3, 2024 at 6:23 pm #1461240I 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.July 4, 2024 at 7:49 am #1461276Hi,
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,
IsmaelJuly 4, 2024 at 8:33 pm #1461378All 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>July 5, 2024 at 7:06 am #1461420Hi,
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,
IsmaelJuly 5, 2024 at 12:48 pm #1461439Hello 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/9da0418c4165b0a0f579d2569c5bb19a4331a6f0I hope that the bug will be fixed with the next WordPress version.
Many thanks for your support
July 5, 2024 at 3:45 pm #1461448 -
AuthorPosts
- You must be logged in to reply to this topic.