Bug 27555

Summary: Use psgi_env from errors/* controller scripts
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Bugs List <koha-bugs>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: dcook, martin.renvoize, matthias.meusburger
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 26048    
Bug Blocks:    
Attachments: Bug 27555: Use psgi_env from errors sripts

Description Jonathan Druart 2021-01-27 10:10:08 UTC
errors/* controller scripts are using
  any { /(^psgi\.|^plack\.)/i } keys %ENV
to know if we are running under psgi.

This is also defined in C4::Auth (psgi_env subroutine), but it's not available as it is in BEGIN.

We should put this trick in an exportable subroutine to make it accessible from pl scripts.
Comment 1 David Cook 2021-01-27 23:19:27 UTC
When I was working on Bug 26048, I thought it would be enough to check for environmental variables starting with "psgi." but I don't think they were being set,  but there were "plack." environmental variables. 

So we'd need to make sure to update "psgi_env" in C4::Auth if we did use it
Comment 2 Jonathan Druart 2021-03-16 10:25:04 UTC
Created attachment 118292 [details] [review]
Bug 27555: Use psgi_env from errors sripts
Comment 3 Jonathan Druart 2021-03-16 10:26:29 UTC
I don't understand why psgi_env and safe_exit were in the BEGIN block.
Should we expect a regression from CAS or Shib auth here?
Comment 4 Martin Renvoize 2021-03-16 14:05:21 UTC
Hmm, pass I'm afraid... I think that predates the work I did on Shibboleth.. I just used it.. Hopefully Matts knows?
Comment 5 Matthias Meusburger 2021-03-16 14:18:22 UTC
Hi, 

Actually, the psgi compatibility was written by eiro at the time, see https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=3551

That being said, I don't see why they should be in the BEGIN block either.
Comment 6 Jonathan Druart 2021-12-13 14:58:49 UTC

*** This bug has been marked as a duplicate of bug 29420 ***
Comment 7 Martin Renvoize 2022-03-28 09:27:09 UTC

*** This bug has been marked as a duplicate of bug 29744 ***