sayontan / suffusion

The Suffusion Theme for WordPress
GNU General Public License v3.0
28 stars 18 forks source link

Issue with WordPress 6.5 RC1 and 6.4.3 #82

Closed mbrsolution closed 6 months ago

mbrsolution commented 6 months ago

Hi Marc, I found a small issue with WordPress version 6.5 RC1 and WordPress 6.4.3. When I try to save any of the settings in Suffusion Options, the screen goes blank. If I refresh the browser the screen appears again with the changes made. I have tested this on a few browsers with the same results.

Other information: -WordPress version 6.5 RC1 and 6.4.3 -PHP version 8.2.4 and PHP 8.1.27. -Suffusion version 4.6.3. Note: I also deleted the theme and downloaded a fresh copy from Github. -No other plugin active during the test.

Let me know if you need more information or more testing.

Kind regards, Manuel

mbtools commented 6 months ago

I will have a look once one of my systems is updated

marcissimus commented 6 months ago

The issue also occurs on my site. However, I have not been able to find the root cause yet...

Can you confirm if this worked correctly in 6.4.1 or 6.4.2?

mbrsolution commented 6 months ago

I am in the process of setting up two sites locally, one with WordPress 6.4.1 and the other with WordPress 6.4.2. I will let you know what happens.

Kind regards, Manuel

mbrsolution commented 6 months ago

Hi, while I was carrying out a test with a new WordPress installation, I installed and activated Suffusion. When I went to save the changes in Suffusion Options I got the following warning message.

Warning: unlink(D:\xampp824\htdocs\wordpress641/wp-content/uploads/suffusion/custom-styles.css): No such file or directory in D:\xampp824\htdocs\wordpress641\wp-content\themes\suffusion\admin\suffusion-options-page.php on line 164

The above warning is coming from the following code.

if (is_array($custom_css) && isset($custom_css['css'])) {
        unlink($filename); // pre-empty  <---- This part of the code is line 164 ------
        if (!$wp_filesystem->put_contents($filename, $custom_css['css'], FS_CHMOD_FILE)) {
            echo "<div class='error'><p>Failed to save file $filename. Please check your folder permissions.</p></div>";
        }
    }

I did check the path and the following file custom-styles.css does exist. So I am not sure why the warning message appeared.

I then refreshed the browser and the warning message did not appear anymore but the issue is still there. Unfortunately I was not able to test WordPress 6.4.1 because WordPress automatically updated my site to the latest version the moment I logged in :(

I thought I would share the above warning message to you. Perhaps this gives you a clue.

However I will try to test WordPress 6.4.1 again but first I have to try and force WordPress from updating to the latest version.

Note: I did manage to test WordPress 6.4.2 without updating to WordPress 6.4.3 :) and I received the same warning message as above. The warning message appeared and then vanished after I refreshed the browser. So I suspect the issue might be coming from the PHP code above.

Let me know if you need more help or testing done.

Kind regards, Manuel

marcissimus commented 6 months ago

The warning happens only the first time, when the custom-styles.css file does not exist yet. https://github.com/sayontan/suffusion/pull/84 should avoid the warning.

I found the problem. There was a mistake in the PHP 8.3 upport which I fixed with #85

marcissimus commented 6 months ago

I included everything in 4.6.4. Let me know if this works for you

mbrsolution commented 6 months ago

It is working as expected 👍 Thank you, Manuel