[Koha-bugs] [Bug 28489] CGI::Session is incorrectly serialized to DB in production env / when strict_sql_modes = 0

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Jun 2 17:25:56 CEST 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28489

--- Comment #13 from Andrew Nugged <nugged at gmail.com> ---
Yesterday I experimented with the same – I changed to "mediumblob" manually on
my local test server to find a solution and it worked.

What I can say that I found that Data::Dumper when converting Perl strings
scalars acts "fuzzily" (better: weirdly), and if it meets real Unicode chars it
stores them in the string in \xXX perl-form, so they stored in DB properly and
restored properly, for example, I created branch "Čentervälly":

it is stored in MySQL in a_session dumped in this way:

    'branchname' => "\x{10c}enterv\x{e4}lly"

so here it works and no error happens,

but when it meets only single "ä" for example "Hämeenlinna" (and maybe few
other characters like that which suspect can be represented in old ASCII
latin-1 or how that fuzziness fuzzies :)...) chars,
so it stores in such a way in MySQL longtext (broken):

    'branchname' => 'H?meenlinna',

because: see below hex dump of the blob, and when it saves to UTF-8-MySQL-field
– it gets malformed, but yes, with blob it works:

    'branchname' => 'Hämeenlinna',

    and when I looked inside blob in HEX, I see:

    48 E4 6D 65 65 6E 6C 69 6E 6E 61   H‰meenlinna

because it stores ä as E4 and it is then get returned "in the same way" into
"ä" (seems). But oh that's silvertape everywhere :).

This is just to say, that it weird but WORKS with blob, 

so – thanks Julian for the patch, and I say I support it,

(yet I'd blame Data::Dumper "fuzziness" :) )

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list