test case for reported regression
John Napiorkowski [Mon, 25 Jul 2016 20:39:15 +0000 (15:39 -0500)]
Changes
lib/Catalyst.pm
lib/Catalyst/Runtime.pm
t/undef_encoding_regression.t [new file with mode: 0644]

diff --git a/Changes b/Changes
index cae9c78..045ddff 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
 # This file documents the revision history for Perl extension Catalyst.
 
+5.90112 - 2016-07-25
+  - Fixed regression introduced in last release that caused the code to crap out
+    if you set the encoding to 'undef'.
+
 5.90111 - 2016-07-20
   - Improved documentation around some of the unicode changes; tests (melmothx++)
 
index 2d40ae8..7f9fe30 100644 (file)
@@ -204,7 +204,7 @@ sub composed_stats_class {
 __PACKAGE__->_encode_check(Encode::FB_CROAK | Encode::LEAVE_SRC);
 
 # Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.90111';
+our $VERSION = '5.90112';
 $VERSION = eval $VERSION if $VERSION =~ /_/; # numify for warning-free dev releases
 
 sub import {
index 8283b87..75796db 100644 (file)
@@ -7,7 +7,7 @@ BEGIN { require 5.008003; }
 
 # Remember to update this in Catalyst as well!
 
-our $VERSION = '5.90111';
+our $VERSION = '5.90112';
 $VERSION = eval $VERSION if $VERSION =~ /_/; # numify for warning-free dev releases
 
 =head1 NAME
diff --git a/t/undef_encoding_regression.t b/t/undef_encoding_regression.t
new file mode 100644 (file)
index 0000000..049ac71
--- /dev/null
@@ -0,0 +1,42 @@
+use utf8;
+use warnings;
+use strict;
+use Test::More;
+use HTTP::Request::Common;
+use HTTP::Message::PSGI ();
+use Encode 2.21 'decode_utf8', 'encode_utf8', 'encode';
+
+{
+  package MyApp::Controller::Root;
+  $INC{'MyApp/Controller/Root.pm'} = __FILE__;
+
+  use base 'Catalyst::Controller';
+
+  sub heart :Local Args(1) {
+    my ($self, $c, $arg) = @_;
+
+    Test::More::is $c->req->query_parameters->{a}, 111;
+    Test::More::is $c->req->query_parameters->{b}, 222;
+    Test::More::is $arg, 1;
+
+    $c->response->content_type('text/html');
+    $c->response->body("<p>This is path local</p>");
+  }
+
+  package MyApp;
+  use Catalyst;
+
+  MyApp->config(encoding => undef);
+
+  Test::More::ok(MyApp->setup, 'setup app');
+}
+
+use Catalyst::Test 'MyApp';
+
+{
+  my $res = request "/root/heart/1?a=111&b=222";
+  is $res->code, 200, 'OK';
+  is $res->content, '<p>This is path local</p>';
+}
+
+done_testing;