[Koha-bugs] [Bug 32478] Remove Koha::Config::SysPref->find since bypasses cache

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed May 10 14:51:07 CEST 2023


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

--- Comment #15 from Marcel de Rooy <m.de.rooy at rijksmuseum.nl> ---
We remove these lines completely now and just trust ->yaml_preference:
-    foreach my $line (@lines){
-        my ($field,$array) = split /:/, $line;
-        next if !$array;
-        $field =~ s/^\s*|\s*$//g;
-        $array =~ s/[ [\]\r]//g;
-        my @array = split /,/, $array;
-        @array = map { $_ eq '""' || $_ eq "''" ? '' : $_ } @array;
-        @array = map { $_ eq 'NULL' ? undef : $_ } @array;
-        $pref_as_hash->{$field} = \@array;
-    }

But this is not the same. If I pasted correct YAML previously like below, it
would not work.
ccode  :
- null
- NULL
- undefined
- 2
- '3'
Now it does.

But perhaps more serious is the opposite, if I am entering some valid YAML
array by 'forgetting' the first line:
- null
- NULL
- undefined
- 2
- '3'
I will get back an array, while the former routine returned an empty hash !
This will trigger an error like: Not a HASH reference at
/usr/share/koha/Koha/Item.pm line 2071. => foreach my $field (keys
%$denyingrules) {

This is a bit long way of saying: I still think that we may need an
intermediate routine between pure YAML (yaml_preference) and what we expect for
specific preferences?

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


More information about the Koha-bugs mailing list