• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5656: CGI::charset called in BEGIN{} breaks mod_perl preloading of TWiki.pm

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Urgent Closed   patch 4.2.1, 5.0.0

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

TWiki.pm calls CGI::charset during BEGIN{} if {Site}{CharSet} is set. Unfortunately under mod_perl, a directive like PerlModule "TWiki.pm" fails because CGI needs to instantiate itself to set charset (charset is an instance variable) and instantiating itself under mod_perl requires the global $r Apache::RequestRec to exist, which it won't yet during perl startup. The solution should be to move the CGI::charset call outside of the BEGIN{} block.

-- TWiki:Main/JoshuaCharlesCampbell - 26 May 2008

CGI 3.15 perl 5.8.8 (.10.el5_0.2) Centos 5.1

-- TWiki:Main.JoshuaCharlesCampbell - 26 May 2008

Patch vs 4.2.0:

--- lib/TWiki.pm.old    2008-05-26 22:16:34.000000000 -0600
+++ lib/TWiki.pm        2008-05-26 22:17:36.000000000 -0600
@@ -330,12 +330,6 @@
     $functionTags{SHORTLANG} = sub { $TWiki::cfg{Site}{Lang} || '' };
     $functionTags{LANG}      = sub { $TWiki::cfg{Site}{FullLang} || '' };
 
-    # Tell CGI.pm which charset we are using if not default
-    if( defined $TWiki::cfg{Site}{CharSet} &&
-          $TWiki::cfg{Site}{CharSet} !~ /^iso-?8859-?1$/io ) {
-        CGI::charset( $TWiki::cfg{Site}{CharSet} );
-    }
-
     # Set up pre-compiled regexes for use in rendering.  All regexes with
     # unchanging variables in match should use the '/o' option.
     # In the regex hash, all precompiled REs have "Regex" at the
@@ -1265,6 +1259,12 @@
     $query ||= new CGI( {} );
     my $this = bless( {}, $class );
 
+    # Tell CGI.pm which charset we are using if not default
+    if( defined $TWiki::cfg{Site}{CharSet} &&
+          $TWiki::cfg{Site}{CharSet} !~ /^iso-?8859-?1$/io ) {
+        $query->charset( $TWiki::cfg{Site}{CharSet} );
+    }
+
     $this->{_HTMLHEADERS} = {};
     $this->{context} = $initialContext;

-- TWiki:Main.JoshuaCharlesCampbell - 27 May 2008

Good catch, Joshua. There is no point in setting the charset until CGI is up and running.

Confirmed, and reprioritised to Urgent. Someone needs to apply the patch (I've checked it, it's good)

-- CrawfordCurrie - 27 May 2008

patch monkey do smile

-- SvenDowideit - 27 May 2008

ItemTemplate
Summary CGI::charset called in BEGIN{} breaks mod_perl preloading of TWiki.pm
ReportedBy TWiki:Main.JoshuaCharlesCampbell
Codebase 4.2.0
SVN Range

AppliesTo Engine
Component

Priority Urgent
CurrentState Closed
WaitingFor

Checkins TWikirev:16846 TWikirev:16847
TargetRelease patch
ReleasedIn 4.2.1, 5.0.0
Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r7 - 2008-08-04 - KennethLavrsen
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback