Subject: | URL contains ?;;x= -> Catalyst.pm issues warnings |
$ catalyst.pl MyApp
[...]
$ cd MyApp
$ script/myapp_test.pl '/?;;x=' >/dev/null
[debug] Debug messages enabled
[debug] Statistics enabled
[debug] Loaded plugins:
.----------------------------------------------------------------------------.
| Catalyst::Plugin::ConfigLoader 0.20
|
| Catalyst::Plugin::Static::Simple 0.20
|
'----------------------------------------------------------------------------'
[debug] Loaded dispatcher "Catalyst::Dispatcher"
[debug] Loaded engine "Catalyst::Engine::CGI"
[debug] Found home "/tmp/MyApp"
[debug] Loaded Config "/tmp/MyApp/myapp.yml"
[debug] Loaded components:
.-----------------------------------------------------------------+----------.
| Class | Type
|
+-----------------------------------------------------------------+----------+
| MyApp::Controller::Root |
instance |
'-----------------------------------------------------------------+----------'
[debug] Loaded Private actions:
.----------------------+--------------------------------------+--------------.
| Private | Class | Method
|
+----------------------+--------------------------------------+--------------+
| /default | MyApp::Controller::Root | default
|
| /end | MyApp::Controller::Root | end
|
| /index | MyApp::Controller::Root | index
|
'----------------------+--------------------------------------+--------------'
[debug] Loaded Path actions:
.-------------------------------------+--------------------------------------.
| Path | Private
|
+-------------------------------------+--------------------------------------+
| / | /default
|
| / | /index
|
'-------------------------------------+--------------------------------------'
[info] MyApp powered by Catalyst 5.7014
Use of uninitialized value in join or string at
/usr/local/share/perl/5.8.8/Catalyst.pm line 1737.
Use of uninitialized value in join or string at
/usr/local/share/perl/5.8.8/Catalyst.pm line 1737.
[info] *** Request 1 (1.000/s) [13725] [Wed Jun 4 10:01:17 2008] ***
[debug] Query Parameters are:
.-------------------------------------+--------------------------------------.
| Parameter | Value
|
+-------------------------------------+--------------------------------------+
| | ,
|
| x |
|
'-------------------------------------+--------------------------------------'
[debug] "GET" request for "/" from "127.0.0.1"
[info] Request took 0.007436s (134.481/s)
.----------------------------------------------------------------+-----------.
| Action | Time
|
+----------------------------------------------------------------+-----------+
| /index |
0.000509s |
| /end |
0.000737s |
'----------------------------------------------------------------+-----------'
These warnings also occur when I use '&' instead of ';' (but only when
running in debug mode).
The parsing of arguments looks also wrong, since Catalyst thinks there
are two params instead of one, as a
$c->log->_dump( $c->req->params );
gives
{ "" => [undef, undef], "x" => "" }
Catalyst-Runtime: 5.7014
$ perl -v
This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
A patch against Catalyst::Engine and a testcase against 5.7014 is attached.
Thanks, Frank
Subject: | live_engine_request_parameters.t.patch |
--- t/live_engine_request_parameters.t.old 2008-05-26 00:39:06.000000000 +0200
+++ t/live_engine_request_parameters.t 2008-06-04 10:22:12.000000000 +0200
@@ -6,7 +6,7 @@
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 40;
+use Test::More tests => 46;
use Catalyst::Test 'TestApp';
use Catalyst::Request;
@@ -137,3 +137,14 @@
ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
is( $creq->{uri}->query, 'x=1&y=1&z=1', 'Catalyst::Request GET query_string' );
}
+
+{
+ my $creq;
+ ok( my $response = request("http://localhost/dump/request?&&q="),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ ok( eval '$creq = ' . $response->content );
+ is( keys %{$creq->{parameters}}, 1, 'remove empty parameter' );
+ is $creq->{parameters}->{q}, '', 'empty parameter';
+}
Subject: | Engine.pm.patch |
--- lib/Catalyst/Engine.pm.old 2008-04-06 17:29:11.000000000 +0200
+++ lib/Catalyst/Engine.pm 2008-06-04 10:24:54.000000000 +0200
@@ -452,7 +452,7 @@
# replace semi-colons
$query_string =~ s/;/&/g;
- my @params = split /&/, $query_string;
+ my @params = grep { $_ } split /&/, $query_string;
for my $item ( @params ) {