Page 1 of 1

fail to save setttings

Posted: 11 Dec 2025, 06:12
by flep
X3 previously ran perfectly fine on my server space.
Recently, I uploaded new photos and found that newly created albums couldn't save settings. Each album's JSON file was created, but my settings changes weren't saved; it always reverted to the initial content. 
I tried clearing the cache and accessing the backend settings, but for some reason, I couldn't log in with my administrator account and password. 
As a last resort, I logged in via FTP, deleted `config.user.json`, and then logged in with the default admin account. 
Then I discovered that the settings for the entire album system were no longer saved. "Show X3 Diagnostics" remained enabled. Even after unchecking it and saving, it showed as disabled, but refreshing the page made it re-enabled… 
Initially, I thought it was a problem with my hosting space, so I contacted my service provider. They checked and said there were no issues with reading or writing the JSON files. They hadn't made any new changes… 
This is so strange…

Re: fail to save setttings

Posted: 12 Dec 2025, 01:50
by mjau-mjau
flep wrote: This is so strange…
A bit hard for me to understand what's going. I could do some tests for you if you want, if you can provide me panel login. For me to be able to test, I would need to be able to reproduce errors somehow. Could the storage/hosting/server disk have been full (or over quota)? In X3, you will normally get errors for anything that doesn't work. Even if a firewall is blocking settings saves (POST requests), you will get an error in panel.

Unless the issue is resolved already, I can try to diagnose with some more info.

Re: fail to save setttings

Posted: 12 Dec 2025, 02:22
by flep
Thank you~
I have sent PM to you with my panel links.

Re: fail to save setttings

Posted: 12 Dec 2025, 22:36
by mjau-mjau
flep wrote: Thank you~
I have sent PM to you with my panel links.
I replied in PM.

Re: fail to save setttings

Posted: 13 Dec 2025, 22:12
by mjau-mjau
It seems to work now, please check.

The problem was this line in panel/X3.php which parses json data from the panel before saving in settings:
Code
$parsed = function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() ? stripslashes($str) : $str;
Disabled and changed to:
Code
$parsed = $str;
I'm not sure what the problem is with this on your server. According to PHP docs get_magic_quotes_gpc() should return false, and even if true, stripslashes() should work. Anyway it works now, and the original code should probably be updated/removed, since get_magic_quotes_gpc() is deprecated.

Re: fail to save setttings

Posted: 14 Dec 2025, 02:48
by flep
mjau-mjau wrote: It seems to work now, please check.

The problem was this line in panel/X3.php which parses json data from the panel before saving in settings:
Code
$parsed = function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc() ? stripslashes($str) : $str;
Disabled and changed to:
Code
$parsed = $str;
I'm not sure what the problem is with this on your server. According to PHP docs get_magic_quotes_gpc() should return false, and even if true, stripslashes() should work. Anyway it works now, and the original code should probably be updated/removed, since get_magic_quotes_gpc() is deprecated.
Thanks a lot~~!
It wokrs now.
Thank you very much for helping resolve this issue.