for people that do silly things
John Napiorkowski [Wed, 21 Sep 2016 10:24:40 +0000 (05:24 -0500)]
lib/Catalyst.pm
t/evil_stash.t [new file with mode: 0644]

index e68e18c..a71f655 100644 (file)
@@ -2490,6 +2490,7 @@ sub prepare {
     };
 
     $c->log_request;
+    $c->{stash} = $c->stash;
 
     return $c;
 }
diff --git a/t/evil_stash.t b/t/evil_stash.t
new file mode 100644 (file)
index 0000000..e97a131
--- /dev/null
@@ -0,0 +1,37 @@
+use warnings;
+use strict;
+use Test::More;
+
+{
+  package MyApp::Controller::Root;
+  $INC{'MyApp/Controller/Root.pm'} = __FILE__;
+
+  use base 'Catalyst::Controller';
+
+  sub root :Path('') Args(0) {
+    my ($self, $c) = @_;
+    $c->{stash}->{foo} = 'bar';
+    $c->stash(baz=>'boor');
+    $c->{stash}->{baz} = $c->stash->{baz} . 2;
+    
+    Test::More::is($c->stash->{foo}, 'bar');
+    Test::More::is($c->stash->{baz}, 'boor2');
+    Test::More::is($c->{stash}->{foo}, 'bar');
+    Test::More::is($c->{stash}->{baz}, 'boor2');
+
+    $c->res->body('return');
+  }
+
+  package MyApp;
+  use Catalyst;
+  MyApp->setup;
+}
+
+use HTTP::Request::Common;
+use Catalyst::Test 'MyApp';
+
+{
+   ok my $res = request POST 'root/';
+}
+
+done_testing();