• 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.

Item6766: DBIQueryPlugin's protected option causes page error on TWiki 5 - worked on TWiki4

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension DBIQueryPlugin Normal New   n/a  

Edit Form Data

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

Detail

On TWiki 5, I get an error
TWiki detected an internal error - please check your TWiki logs and webserver logs for more information.

Can't locate object method "unescapeHTML" via package "TWiki::Request"

However, this same thing works on TWiki 4.

The log file entry for this is

| 2011-07-09 - 1
2:41 | Can't locate object method "unescapeHTML" via package "TWiki::Request" at /var/www/twiki/lib/TWiki/Plugins/DBIQueryPlugin.pm line 130.

The code around this area reads:

sub unprotectValue
{
    my $val = shift;
    dprint "Before unprotecting: $val\n";
    my $cgiQuery = TWiki::Func::getCgiQuery();
    $val = $cgiQuery->unescapeHTML($val);
    $val =~ s/(?<!\\)\\n/\n/gs;
    $val =~ s/(?<!\\)\\r/\r/gs;
    $val =~ s/\\\\(n|r)/\\$1/gs;
    $val =~ s/\.(.)/$1/gs;
    dprint "After unprotecting: $val\n";
    return $val;
}

When I check the getCGIQuery() function, I notice that it has changed between versions 4 and 5, viz.

In TWiki 4, it was
sub getCgiQuery {
    ASSERT($TWiki::Plugins::SESSION) if DEBUG;
    return $TWiki::Plugins::SESSION->{cgiQuery};
}

In TWiki 5, it is

sub getCgiQuery {
    ASSERT($TWiki::Plugins::SESSION) if DEBUG;
    return $TWiki::Plugins::SESSION->{request};
}

Does request.pm need to explicitly support escapeHTML and unescapeHTML?

The offending TML is the following...

%DBI_QUERY{"Zermatt" protected="description schedules" }%
SELECT product_id, product_name, description, schedules from product WHERE product_id = '%URLPARAM{product_id}%' 
.body
....
....
%DBI_QUERY%

If I remove the "protected=...", then I do not get an error, but the contents of the database fields messes up the page display.

Should this be considered a Plugin problem, or a TWiki compatibility issue?

Since this option has been used in many pages, it is causing us a delay in upgrading from TWiki 4 to Twiki 5.

-- TWiki:Main/DipuDeshmukh - 2011-07-09

Lowering the priority. Trying to workaround by not using the option for now.

-- TWiki:Main.DipuDeshmukh - 2011-07-10

TWiki-5.0 has its own CGI request method. This has bitten plugin programmers elsewhere too. Safest to not rely on CGI functions. Hand-craft the entity decoding (as in TWiki::Plugins::DBCachePlugin::Core::entityDecode), or use CPAN:HTML::Entities.

-- TWiki:Main.PeterThoeny - 2011-07-11

ItemTemplate
Summary DBIQueryPlugin's protected option causes page error on TWiki 5 - worked on TWiki4
ReportedBy TWiki:Main.DipuDeshmukh
Codebase 5.0.1, 5.0.2
SVN Range TWiki-5.1.0-trunk, Mon, 13 Jun 2011, build 21497
AppliesTo Extension
Component DBIQueryPlugin
Priority Normal
CurrentState New
WaitingFor

Checkins

TargetRelease n/a
ReleasedIn

Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2011-07-11 - PeterThoeny
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback