Item10267: I18N.pm: Use of uninitialized value in lc

pencil
Priority: Normal
Current State: Closed
Released In: 1.1.3
Target Release: patch
Applies To: Engine
Component:
Branches:
Reported By: ChristianZiemski
Waiting For:
Last Change By: KennethLavrsen
In Apache's error_log there are many lines as

> Use of uninitialized value $tag in lc at /var/www/foswiki/lib/Foswiki/I18N.pm line 51.

They occur on navigating to almost any Wiki page until the user switches language in TopBar's drop down box once.

Another way to prevent it seems to be to define a language in user's preferences like
  • Set LANGUAGE = de

But then the errors are listed at least until the user logs in.

tools/mailnotify gets the errors as well.

I tested two possible fixes in I18N.pm:

1) My own one:
    sub _normalize_language_tag {
        my $tag = shift;
        if ( not $tag ) { return '' }  # fix
        $tag = lc($tag);

2) Or according to http://foswiki.org/Tasks/Item9151 (Item9151: use of uninitialised value in lc())
    sub _normalize_language_tag {
        my $tag = shift;
        $tag = lc($tag || '' );      # fix

Now it's much more quiet in error_log.

-- ChristianZiemski - 18 Jan 2011

 

ItemTemplate editieren

Summary I18N.pm: Use of uninitialized value in lc
ReportedBy ChristianZiemski
Codebase 1.1.2, trunk
SVN Range
AppliesTo Engine
Component
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:089fb59adf98 distro:aec27123bba7
TargetRelease patch
ReleasedIn 1.1.3
Topic-Revision: r5 - 16 Apr 2011, KennethLavrsen
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy