fix(prefs): cast values to string before binary SQL storage#7
Merged
Conversation
Checkbox and number preferences are stored as integers by the UI layer. Passing those scalars to Horde_Db_Value_Binary caused empty blobs to be written to horde_prefs, so settings such as IMP use_trash looked saved but reloaded as disabled.
ralflang
requested changes
Jun 18, 2026
ralflang
pushed a commit
that referenced
this pull request
Jun 18, 2026
Address review on PR #7: - Move strval() inside convertCharset() so non-string scalars are normalized before charset conversion, not after - Switch from legacy Horde_String to PSR-4 Horde\Util\HordeString
Address review on PR #7: - Move strval() inside convertCharset() so non-string scalars are normalized before charset conversion, not after - Switch from legacy Horde_String to PSR-4 Horde\Util\HordeString
d4e89e9 to
8bd7f6d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
strval()before storing them asHorde_Db_Value_Binaryinhorde_prefsuse_trash) that appeared to save successfully but reloaded with empty valuesProblem
The preferences UI stores checkbox values via
intval(), producing integer0/1.Horde_Prefs_Storage_Sqlpassed those values directly toHorde_Db_Value_Binary. The PDO blob helper only serializes string data; integers were written as empty blobs.Observed symptom in IMP:
pref_valueis emptySolution
Normalize the value to a string before charset conversion and binary wrapping:
Preference storage is string-based by design; this keeps SQL storage aligned with that contract regardless of upstream scalar types.
Test plan
use_trashas enabled for a test userhorde_prefs.pref_valuecontains1(not an empty blob)use_trashis enabled0is stored correctly