From 2f2642bbd4bf040b07d1bba5fd2a93da5bd74cf6 Mon Sep 17 00:00:00 2001 From: Frenck Lutke Date: Thu, 25 Feb 2021 12:06:25 +0100 Subject: [PATCH 1/2] add fallback for feed_language on edit-feed-saving Feed_language is only included in the form if running on pgsql, failing the not null constraint on mysql setups. --- classes/pref/feeds.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php index 086c52697..755413f13 100755 --- a/classes/pref/feeds.php +++ b/classes/pref/feeds.php @@ -710,7 +710,7 @@ class Pref_Feeds extends Handler_Protected { $mark_unread_on_update = checkbox_to_sql_bool( clean($_POST["mark_unread_on_update"] ?? "")); - $feed_language = clean($_POST["feed_language"]); + $feed_language = clean($_POST["feed_language"] ?? ""); if (!$batch) { From 27b676b7b2f79856fe72cd614372c7a9a0e58939 Mon Sep 17 00:00:00 2001 From: Frenck Lutke Date: Thu, 25 Feb 2021 12:24:23 +0100 Subject: [PATCH 2/2] fix checkboxes shown as checked when they're not with mysql The issue occurs because boolean/tinyint values are retrieved from mysql as strings, and in php/js all non-empty strings are cast as boolean true. Current PDO mysql driver doesn't support `PDO::ATTR_STRINGIFY_FETCHES = false`, and if I disable prepare-emulation so it uses the native MySQL driver instead which supposedly does support it, prepare statements no longer play nice with named parameters. Every remaining clean solution that comes to mind that can cover all cases, just for MySQL, adds an annoying amount of additional code / overhead. As long as the `App.FormFields.checkbox_tag()` JS function is the only one suffering from the lack of conversion, I'll go with easy ugly over here. --- js/App.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/App.js b/js/App.js index 67d932369..db1e7459e 100644 --- a/js/App.js +++ b/js/App.js @@ -43,8 +43,9 @@ const App = { return this.button_tag(value, "", {...{onclick: "App.dialogOf(this).hide()"}, ...attributes}); }, checkbox_tag: function(name, checked = false, value = "", attributes = {}, id = "") { + // checked !== '0' prevents mysql "boolean" false to be implicitly cast as true return `` },