Commit 2f00765b authored by Clément OUDOT's avatar Clément OUDOT
Browse files

quote meta characters in extract_lang method (#841)

parent 700ed743
......@@ -368,7 +368,7 @@ sub extract_lang {
$lang = ( split /-/, $lang )[0];
# Go to next if lang was already added
next if grep( /$lang/, @res );
next if grep( /\Q$lang\E/, @res );
# Store lang only if size is 2 characters
push @res, $lang if ( length($lang) == 2 );
......
......@@ -7,7 +7,7 @@
package My::Portal;
use strict;
use Test::More tests => 22;
use Test::More tests => 25;
use_ok('Lemonldap::NG::Common::CGI');
#our @ISA = qw('Lemonldap::NG::Common::CGI');
......@@ -110,6 +110,13 @@ SKIP: {
ok( $lang->[1] eq 'en', 'extract_lang Android' );
ok( scalar(@$lang) == 2, 'extract_lang Android' );
# Extract lang with * value
my $cgi4;
$ENV{HTTP_ACCEPT_LANGUAGE} = "fr,en,*";
ok( ( $cgi4 = Lemonldap::NG::Common::CGI->new() ), 'New CGI' );
ok( $lang = $cgi4->extract_lang(), 'extract_lang with * value' );
ok( scalar(@$lang) == 2, 'extract_lang with * value' );
# SOAP
eval { require SOAP::Lite };
skip "SOAP::Lite is not installed, so CGI SOAP functions will not work", 3
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment