Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SelectEmailPrefs #117

Open
kodiakseraphim opened this issue Nov 27, 2024 · 2 comments
Open

SelectEmailPrefs #117

kodiakseraphim opened this issue Nov 27, 2024 · 2 comments

Comments

@kodiakseraphim
Copy link

kodiakseraphim commented Nov 27, 2024

Errors being addressed:

[Mon Nov 25 20:33:23.852016 2024] [cgi:error] [pid 853343] [client 127.0.0.1:46582] AH01215: DBD::mysql::st execute failed: Column 'Name' cannot be null at SelectEmailPrefs line 276.

[Mon Nov 25 20:44:17.505547 2024] [cgi:error] [pid 853343] [client 127.0.0.1:38512] AH01215: DBD::mysql::st execute failed: Incorrect integer value: '' for column <dbname>.EmailUser.PreferHTML at row 1 at SelectEmailPrefs line 276.

Discussion:

$Name was being blanked out at line 109 causing a null field. The problem probably surfaced due to STRICT_TRANS_TABLES being default on in 10.3.39-MariaDB . Also, I set the $HTML preference to the default value of 0 so that the row updates correctly.

Patch:

diff --git a/SelectEmailPrefs.orig b/SelectEmailPrefs
index f5f4f85..1e41a41 100755
--- a/SelectEmailPrefs.orig
+++ b/SelectEmailPrefs
@@ -270,6 +270,8 @@ if ($Mode eq "update") {
     my $UpdateUserInfo = $dbh -> prepare("update EmailUser set EmailAddress=?,PreferHTML=? where EmailUserID=?");
     $UpdateUserInfo -> execute($Email,$HTML,$EmailUserID);
   } else {
+    my $Name = $Untaint -> extract(-as_safehtml => "name") || "";
+    if ($HTML eq "") { $HTML = 0; }
     my $UpdateUserInfo = $dbh -> prepare("update EmailUser set Name=?,EmailAddress=?,PreferHTML=? where EmailUserID=?");
     $UpdateUserInfo -> execute($Name,$Email,$HTML,$EmailUserID);
   }
@pms967
Copy link

pms967 commented Nov 27, 2024

@kodiakseraphim you should enclose the diff text into a code block, or (as you can see) the code will be screwed...

@kodiakseraphim
Copy link
Author

@pms967 Thanks for pointing that out! It should be good now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants