Cannot save settings for any plugin

Found a bug? Tell us!!
Post Reply
DragonLord
Regular
Posts: 7
Joined: Sat Feb 08, 2014 8:21 pm

Cannot save settings for any plugin

Post by DragonLord »

Serendipity 1.7.8 with PHP 5.4.20 and PostgreSQL 9.2.4 backend on openSUSE 13.1. All communication with the server is over HTTPS.

For some reason, when I try to save settings for any plugin (not just Spam Protector), they are reverted to the previous settings, despite S9y confirming that the settings are saved without errors. All permissions are correct, and I can install and remove plugins, post and edit entries, and reconfigure other parts of the blog. Clearing cookies and logging back in does not help.

Why is this happening, and what can I do?

--DragonLord
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: Cannot save settings for any plugin

Post by Timbalu »

No idea.
Mine are working (Serendipity 1.7.8 und PHP 5.4.24).

Did you check error and access.log files?
Did you check without HTTPS`?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Cannot save settings for any plugin

Post by garvinhicking »

Hi!

Maybe you can check the serendipity_config database table; this is the one that holds all settings. Maybe something in the table is corrupted or there are duplicate entries.

Maybe you can also try to edit the values in the serendipity_config database table just to see if you can edit them at all, and if they are reflected in the s9y configuration tool.

Serendipit itself stores the configuration through the method serendipity_set_config_var() which is defined in include/functions_config.inc.php:

Code: Select all

function serendipity_set_config_var($name, $val, $authorid = 0) {
    global $serendipity;

    serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}config where name='" . serendipity_db_escape_string($name) . "' AND authorid = " . (int)$authorid);

    if ($name == 'password' || $name == 'check_password') {
        return;
    }

    $r = serendipity_db_insert('config', array('name' => $name, 'value' => $val, 'authorid' => $authorid));

    if ($authorid === 0 || $authorid === $serendipity['authorid']) {
        if ($val === 'false') {
            $serendipity[$name] = false;
        } else {
            $serendipity[$name] = $val;
        }
    }

    if (is_string($r)) {
        echo $r;
    }
}
you could try and debug this code to see whats (not) happening:

Code: Select all

function serendipity_set_config_var($name, $val, $authorid = 0) {
    global $serendipity;

    echo "DELETE OLD: DELETE FROM {$serendipity['dbPrefix']}config where name='" . serendipity_db_escape_string($name) . "' AND authorid = " . (int)$authorid . "<br />\n";
    serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}config where name='" . serendipity_db_escape_string($name) . "' AND authorid = " . (int)$authorid);

    if ($name == 'password' || $name == 'check_password') {
        echo "ABORTING TO SAVE $name<br />\n";
        return;
    }

    $r = serendipity_db_insert('config', array('name' => $name, 'value' => $val, 'authorid' => $authorid));

    echo "INSERTED NEW: " . print_r($r, true) . " for $name / $val / $authorid<br />\n";

    if ($authorid === 0 || $authorid === $serendipity['authorid']) {
        if ($val === 'false') {
            $serendipity[$name] = false;
        } else {
            $serendipity[$name] = $val;
        }
    }

    if (is_string($r)) {
        echo $r;
    }
}


Then you should get some output on what's happening...
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
DragonLord
Regular
Posts: 7
Joined: Sat Feb 08, 2014 8:21 pm

Re: Cannot save settings for any plugin

Post by DragonLord »

Turning off SSL does not help, and neither the Apache logs nor the PostgreSQL logs indicate any errors. I'll patch the configuration file with the debug function shortly.

--DragonLord
DragonLord
Regular
Posts: 7
Joined: Sat Feb 08, 2014 8:21 pm

Re: Cannot save settings for any plugin

Post by DragonLord »

I've identified the cause of this problem. It turns out OPcache (a PHP accelerator) was causing the problem. I've replaced it with APC, and it now works.

In any case, this is probably a bug. Can you add some information regarding PHP accelerators/opcode caches to the documentation?

--DragonLord
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Cannot save settings for any plugin

Post by garvinhicking »

In any case, this is probably a bug. Can you add some information regarding PHP accelerators/opcode caches to the documentation?
I'm not really a pro when it comes to those extensions, so before we put half-knowledge in there, I'd rather like to have documentation about opcode/caches on those projects themselves... what specifically are you thinking about? Maybe if it's some broad information or just a link, we could of course add this somewhere?!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply