Bug 41440: (QA follow-up) Handle undef "script"

This silences warnings about undefinved values in the cache key

This seems to come from some calls in _build_languages_arrayref where we might not
have all variants of a language - the call could be prevented, but I am not sure
what the effects would be, so I simply convert undef (null value) to "undef" (string)
and use that as the cache key

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 365770c396)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
Nick Clemens 2026-04-01 18:15:32 +00:00 committed by Jacob O'Mara
parent c26cef4481
commit 945512c0f8
No known key found for this signature in database
1 changed files with 2 additions and 1 deletions

View File

@ -481,8 +481,9 @@ Missing POD for language_get_description.
sub language_get_description {
my ( $script, $lang, $type ) = @_;
my $script_key = $script || "undef";
my $memory_cache = Koha::Cache::Memory::Lite->get_instance;
my $cache_key = "Language_descriptions:$script:$lang:$type";
my $cache_key = "Language_descriptions:$script_key:$lang:$type";
my $cached = $memory_cache->get_from_cache($cache_key);
return $cached if $cached;