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>
This commit is contained in:
parent
0f26c7c3d7
commit
5f492e3049
|
|
@ -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…
Reference in New Issue