[Koha-bugs] [Bug 31042] OVERRIDE_SYSPREF does not work for REST API

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Oct 12 04:39:18 CEST 2022


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

--- Comment #4 from David Cook <dcook at prosentient.com.au> ---
I'm looking at custom code right now but there's a little over 100 instances of
$ENV in the code I'm looking at.

For CGI-style .pl scripts, that should be fine. 

For Perl modules, it's more of a problem since they can be used by Mojolicious
code and create bugs as a result. Like we're seeing now.

--

I suppose one option would be to move $ENV calls to C4::Context->env(...) which
could check %ENV and/or a $req_env variable which could be set per request
(using various mechanisms). That seems like a bit of a hack though.

The shortest path is just to pollute %ENV like we're doing with REMOTE_ADDR. 

--

Another idea for this very particular use case would be to create a cache in
C4::Context and then use before_dispatch hook in Koha/REST/V1.pm to set that
C4::Context cache from the $env variable. 

(That works while we're using synchronous requests, but if we used Mojo
asynchronously then that would probably be vulnerable to a race condition.)

--

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


More information about the Koha-bugs mailing list