diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Init.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Init.pm index 0272e75b5..ddb52931d 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Init.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Init.pm @@ -356,11 +356,7 @@ sub reloadConf { # Clean $req->pdata after authentication push @{ $self->endAuth }, sub { - - my $tmp = - ( ref( $_[0]->pdata->{keepPdata} ) eq 'ARRAY' ) - ? $_[0]->pdata->{keepPdata} - : []; + my $tmp = $_[0]->pdata->{keepPdata} //= []; foreach my $k ( keys %{ $_[0]->pdata } ) { unless ( grep { $_ eq $k } @$tmp ) { $self->logger->debug("Removing $k from pdata"); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm index f73887179..c30a28f97 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm @@ -162,10 +162,7 @@ sub authLogout { my ( $self, $req ) = @_; my $res = $self->_authentication->authLogout($req); $self->logger->debug('Cleaning pdata'); - my $tmp = - ( ref( $req->pdata->{keepPdata} ) eq 'ARRAY' ) - ? $req->pdata->{keepPdata} - : []; + my $tmp = $req->pdata->{keepPdata} //= []; foreach my $k ( keys %{ $req->pdata } ) { delete $req->pdata->{$k} unless ( grep { $_ eq $k } @$tmp ); } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm index 7c42a31be..3f479d13a 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm @@ -63,6 +63,13 @@ sub handler { $self->logger->error("Bad JSON content in cookie pdata"); $req->pdata( {} ); } + + # Avoid fatal errors when using old keepPdata format + if ( $req->pdata->{keepPdata} + and not( ref $req->pdata->{keepPdata} eq "ARRAY" ) ) + { + $req->pdata->{keepPdata} = []; + } } my $res = $self->Lemonldap::NG::Common::PSGI::Router::handler($req);