Skip to content

[2.1] Upgrader - Fix issues with json conversion#9271

Draft
sbulen wants to merge 3 commits into
SimpleMachines:release-2.1from
sbulen:21_upgr_fix_unserialize
Draft

[2.1] Upgrader - Fix issues with json conversion#9271
sbulen wants to merge 3 commits into
SimpleMachines:release-2.1from
sbulen:21_upgr_fix_unserialize

Conversation

@sbulen

@sbulen sbulen commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Partial for #9259

The json conversion step had some issues.

  • Due to a typo, safe_unserialize() string fixes were never applied.
  • json_encode can ONLY work on UTF8. Nothing else. Anytime a non-utf8 character was passed, the json_encode would fail & return false.
  • The result was not checked, & "false" was passed to updates, which, for example, might tell updateSettings() to decrement the value of the setting. MariaDB would crash rather than comply; MySQL would change affected settings to -1, e.g., memberlist_cache.
  • The json conversion occurs before the UTF8 conversion... So this would happen even in latin1 databases (umlauts & accents, etc.).

The net result is that many strings were either not converted or blanked out. Settings might be affected, e.g,. memberlist_cache. Most of the issues were with various logs, e.g., log_actions. qanda. Places where user-entered text ended up in a serialized string.

I use a simple "cheezy 2.1 encoding" technique to preserve the non-utf8 strings across json_encode. (Trademark pending.) Got a better idea, let me know... But it works. The UTF8 conversion, which comes later, works as desired & the content is properly migrated to UTF8.

This one is ready to go. If approved, I'll work on the 3.0 version.

sbulen added 3 commits June 14, 2026 14:43
Signed-off-by: Shawn Bulen <bulens@pacbell.net>
Signed-off-by: Shawn Bulen <bulens@pacbell.net>
Signed-off-by: Shawn Bulen <bulens@pacbell.net>
@sbulen

sbulen commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Examples of the types of issues you might see...

In smf_settings:

nax_mysql_settings2

In smf_log_actions:

nax_mysql_log_actions

@sbulen

sbulen commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

If json_encode DID find proper unicode, its default was to escape it, which was bad for SMF:

json_unicode_goof

@sbulen sbulen marked this pull request as draft June 19, 2026 07:05
@sbulen

sbulen commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

Found an issue, need to do some retests...

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

Successfully merging this pull request may close these issues.

1 participant