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

--- Comment #27 from MichaƂ <[email protected]> ---
Okay then my guess right now for most likely cause is that `cmp_deeply` expects
the array elements to be in the same order in $languages as $expected. And
order of elements inside of actual objects doesn't matter, so it's possible
`description` just happens to be first.

I don't see any other logical explanation. This is what I expected, but wasn't
sure why, MariaDB version upgrade sounds like very plausible cause.

If you or someone would happen to have environment set up, they should either
inspect the output of getLanguages with these sample data entered, or just
actually view the tables and/or run the query from getLanguages. My hunch is
that iirc especially since there's no numerical id in these columns, that the
order of elements being returned is an explicit implementation detail of the DB
server which shouldn't matter.

So a fix could be to find or create a test function that'd compare equality of
arrays without regard to the order of elements. And I think neither the new or
old getLanguages had anything that'd reorder languages from what the DB
returned. Which suggests that it'd have regressed regardless of whether my
patch was implemented, it's just that the new tests from Martin caught that.

So if that's the cause, then we could either:
- make tests not care about the order
- make getLanguages query explicitly sort by modifying the SQL query

And actually the latter might be more preferable now that I think about it,
since the order could mess up how languages are shown in Koha interfaces on
language lists!! (In one of the libraries I've heard some complaints about some
language lists being out of order, on older Koha version, but I wasn't
personally looking into the causes, interesting to note though)

And indeed I just checked on koha-staging and also on 24.11 (so before and
after patch!), on /cgi-bin/koha/opac-search.pl, language list is definitely
wrong and not ordered by anything logical!!! (and the order is different on
different servers) So we should probably make a patch to sort it actually and
keep the deep comparison func.

Now backporting a fix would be annoying, since this bug is classified as
enhancement. So we either backport this + a fix, or we make two fixes
targetting separately main and stable branches... (there's behavior change for
displaying "English" instead of "English (English)", so it's not really a pure
bug fix, if we consider bad performance a bug)

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to