Browse Source

Bug 20582: Reset CGI::PARAM_UTF8 to 1 before each CGI request

CGI::Compile calls CGI::initialize_globals before each request, which
resets PARAM_UTF8 to 0
We need to set it back to the correct value

This is the same trick used in debian/templates/plack.psgi

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Julian Maurice 10 months ago
committed by Jonathan Druart
parent
commit
5f492e3049
  1. 12
      Koha/App/Plugin/CGIBinKoha.pm

12
Koha/App/Plugin/CGIBinKoha.pm

@ -21,6 +21,7 @@ use Modern::Perl;
use Mojo::Base 'Mojolicious::Plugin';
use CGI;
use CGI::Compile;
use CGI::Emulate::PSGI;
use IO::Scalar;
@ -28,6 +29,17 @@ use IO::Scalar;
sub register {
my ($self, $app, $conf) = @_;
# CGI::Compile calls CGI::initialize_globals before each request, which resets PARAM_UTF8 to 0
# We need to set it back to the correct value
{
no warnings 'redefine';
my $old_new = \&CGI::new;
*CGI::new = sub {
$CGI::PARAM_UTF8 = 1;
return $old_new->(@_);
};
}
my $opac = $conf->{opac};
my $r = $app->routes;

Loading…
Cancel
Save