Skip to content

Commit

Permalink
config API: Fix postgreSQL wrong cast errors DELETE-ing login cookie …
Browse files Browse the repository at this point in the history
…data

which collides with stored sysinfo_ticker data.
  • Loading branch information
ophian committed Mar 15, 2024
1 parent 97ca0db commit 2cf9acc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions include/functions_config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -643,10 +643,11 @@ function serendipity_issueAutologin($array) {
$cast = 'cast(name AS UNSIGNED)';
}

// Delete possible current cookie. Also delete any autologin keys that smell like 3-week-old, dead fish. Be explicit for postgreSQL casts to exclude sysinfo tickers!
if (isset($serendipity['COOKIE']['author_information'])) {
serendipity_db_query("DELETE FROM {$serendipity['dbPrefix']}options
WHERE okey = 'l_" . serendipity_db_escape_string($serendipity['COOKIE']['author_information']) . "'
OR (okey LIKE 'l_%' AND $cast < " . (time() - 1814400) . ")");
WHERE okey = 'l_" . serendipity_db_escape_string($serendipity['COOKIE']['author_information']) . "' AND name != 'sysinfo_ticker'
OR (name != 'sysinfo_ticker' AND okey LIKE 'l_%' AND $cast < " . (time() - 1814400) . ")");
}

// Issue new autologin cookie
Expand Down

0 comments on commit 2cf9acc

Please sign in to comment.