Advertisement:

Author Topic: [2.0] Blank membergroup names on "Profile Edits" page after convert to UTF-8  (Read 1065 times)

Offline digger

  • Sr. Member
  • ****
  • Posts: 782
  • Gender: Male
    • realdigger on GitHub
    • SMF Russian Community
Function fix_serialized_columns() fixes only topic subjects. There should be code for groups also.

Code: [Select]
$request = $smcFunc['db_query']('', '
        SELECT id_action, extra
        FROM {db_prefix}log_actions
        WHERE action IN ({string:id_group}, {string:additional_groups})',
    array(
        'id_group' => 'id_group',
        'additional_groups' => 'additional_groups',
    )
);


while ($row = $smcFunc['db_fetch_assoc']($request)) {
    if (safe_unserialize($row['extra']) === false && preg_match('~^(a:3:{s:8:"previous";s:)(\d+):"(.*)"(;s:3:"new";s:)(\d+):"(.*)"(;s:10:"applicator";s:\d+:"\d+";})$~',
            $row['extra'], $matches) === 1) {
        $smcFunc['db_query']('', '
                UPDATE {db_prefix}log_actions
                SET extra = {string:extra}
                WHERE id_action = {int:current_action}',
            array(
                'current_action' => $row['id_action'],
                'extra' => $matches[1] . strlen($matches[3]) . ':"' . $matches[3] . '"' . $matches[4] . strlen($matches[6]) . ':"' . $matches[6] . '"' . $matches[7],
            )
        );
    }

}
$smcFunc['db_free_result']($request);

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 72,948
This is unlikely to be fixed in 2.0 but really should be added to 2.1 if it isn't already.

Offline digger

  • Sr. Member
  • ****
  • Posts: 782
  • Gender: Male
    • realdigger on GitHub
    • SMF Russian Community
I found some other serialized actions in smf_log_actions table which needs to be fixed after conversion. Here my version of fix_serialized_columns function.
https://github.com/realdigger/SMF-Fix-Serialized-Strings-After-Conversion