Bug 28359

Summary: Invalid value of OpacHiddenItems crashes OPAC search
Product: Koha Reporter: Victor Grousset/tuxayo <victor>
Component: SearchingAssignee: Bugs List <koha-bugs>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: jonathan.druart, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28125
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 24403    

Description Victor Grousset/tuxayo 2021-05-16 22:05:50 UTC
1. put «damaged: 1» in the syspref
2. in OPAC search something that yield at least on result with a least one item
3. error
   Can't use string ("1") as an ARRAY ref while "strict refs" in use at /kohadevbox/koha/C4/Items.pm line 1012

staff interface search is okay
Comment 1 Jonathan Druart 2021-05-17 15:21:11 UTC
I think this is invalid with bug 28125.
Comment 2 Victor Grousset/tuxayo 2021-05-17 15:49:16 UTC
The about page warning is not likely to be found when hitting the issue. But that can still help. And we have other fish to fry.
If somebody wants to make it easier to find the cause the OPAC search crash, they can send a patch here.

Anyway, «damaged: 1» doesn't trigger the warning ^^"
Comment 3 Jonathan Druart 2021-05-20 07:31:06 UTC
filter_by_visible_in_opac and GetHiddenItemnumbers have different behaviours:


From GetHiddenItemnumbers:
 if (any { $val eq $_ } @{$hidingrules->{$field}}) {
Expect an array (damaged: [1])

From filter_by_visible_in_opac:
  { '-not_in' => $rules->{$field} }
will work for array and scalar

GetHiddenItemnumbers must be removed anyway.
Comment 4 Tomás Cohen Arazi 2021-10-13 15:01:32 UTC
This is no longer valid since bug 23583.

*** This bug has been marked as a duplicate of bug 23583 ***
Comment 5 Tomás Cohen Arazi 2021-10-13 15:03:03 UTC
(In reply to Jonathan Druart from comment #3)
> filter_by_visible_in_opac and GetHiddenItemnumbers have different behaviours:
> 
> 
> From GetHiddenItemnumbers:
>  if (any { $val eq $_ } @{$hidingrules->{$field}}) {
> Expect an array (damaged: [1])
> 
> From filter_by_visible_in_opac:
>   { '-not_in' => $rules->{$field} }
> will work for array and scalar

This is true: it is an unadvertised side-effect of considering the OpacHiddenItems syspref YAML, and not just a subset of YAML.