Page 1 of 1

Cannot save settings for any plugin

Posted: Sun Feb 09, 2014 9:13 pm
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

Re: Cannot save settings for any plugin

Posted: Mon Feb 10, 2014 7:56 am
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`?

Re: Cannot save settings for any plugin

Posted: Mon Feb 10, 2014 2:39 pm
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...

Re: Cannot save settings for any plugin

Posted: Mon Feb 10, 2014 6:17 pm
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

Re: Cannot save settings for any plugin

Posted: Mon Feb 10, 2014 6:26 pm
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

Re: Cannot save settings for any plugin

Posted: Tue Feb 11, 2014 9:21 am
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