Item1300: Foswiki::Store::createWeb uses hash values as keys when changing WebPreferences

pencil
Priority: Normal
Current State: Closed
Released In: 1.0.4
Target Release: patch
Applies To: Engine
Component: Store
Branches:
Reported By: MichaelTempest
Waiting For:
Last Change By: KennethLavrsen
Foswiki::Store.pm, line 1780 contains the following:
foreach my $key (%$opts) {
    $text =~
      s/($Foswiki::regex{setRegex}$key\s*=).*?$/$1 $opts->{$key}/gm;
}

This caused "Use of uninitialized value in concatenation (.) or string at .../lib/Foswiki/Store.pm line 1781." in my Apache log when I tried to create a web.

I think that should be foreach my $key (keys %$opts) {

-- MichaelTempest

Elevating to urgent as this is a potential major failure for users creating webs

-- KennethLavrsen - 15 Mar 2009

Use of %$opts this way iterates the values and the keys in the hash. Since the action of the loop is to substitute existing key values, it would require a value to have the same name as an existing Set key for this to go wrong, which is highly unlikely.

Confirmed that the code is wrong, but this is not a release blocker. Lowering to Normal.

-- CrawfordCurrie - 16 Mar 2009

ItemTemplate edit

Summary Foswiki::Store::createWeb uses hash values as keys when changing WebPreferences
ReportedBy MichaelTempest
Codebase 1.0.3
SVN Range Foswiki-1.0.0, Thu, 08 Jan 2009, build 1878
AppliesTo Engine
Component Store
Priority Normal
CurrentState Closed
WaitingFor
Checkins distro:6e3647995468 distro:c395727b8e8f
TargetRelease patch
ReleasedIn 1.0.4
Topic revision: r7 - 19 Mar 2009, 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