From: John Napiorkowski Date: Mon, 9 Nov 2015 16:43:31 +0000 (-0600) Subject: fixed reportred regression on auto actions X-Git-Tag: 0.090103~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=4c71cf1b43594eabfee6e346a0a30b6dcf315b4f;hp=bd6018c40240ca651d1ff62552b948fc9e691cab fixed reportred regression on auto actions --- diff --git a/Changes b/Changes index 8d2f360..4b7eea9 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,12 @@ # This file documents the revision history for Perl extension Catalyst. +5.90103 - TBD + - More documentation fixes (thanks to the debian maintainers and melmothx++) + - Fixed the way we parse subroutine attribute values to fix a regression + introduced in 5.90102. This is a recommended upgrade (tsibley++, mst++) + - Fixed regression around auto actions that escape by throwing an exception + which was introduced in the last release. + 5.90102 - 2015-10-29 - Better warnings when there's an error reading the psgi.input (billmosley++) - Fixed spurious warnings in uri_for when using no arguments (melmothx++ and diff --git a/lib/Catalyst/Controller.pm b/lib/Catalyst/Controller.pm index 0203b29..a30ae14 100644 --- a/lib/Catalyst/Controller.pm +++ b/lib/Catalyst/Controller.pm @@ -155,6 +155,11 @@ sub _AUTO : Private { my ( $self, $c ) = @_; my @auto = $c->get_actions( 'auto', $c->namespace ); foreach my $auto (@auto) { + # We FORCE the auto action user to explicitly return + # true. We need to do this since there's some auto + # users (Catalyst::Authentication::Credential::HTTP) that + # actually do a detach instead. + $c->state(0); $auto->dispatch( $c ); return 0 unless $c->state; } diff --git a/lib/Catalyst/Delta.pod b/lib/Catalyst/Delta.pod index 95afdc0..bfed979 100755 --- a/lib/Catalyst/Delta.pod +++ b/lib/Catalyst/Delta.pod @@ -7,6 +7,22 @@ Catalyst::Delta - Overview of changes between versions of Catalyst This is an overview of the user-visible changes to Catalyst between major Catalyst releases. +=head2 VERSION 5.90102 - 5.90103 + +A significant change is that we now preserve the value of $c->state from action +to follwoing action. This gives you a new way to pass a value between actions +in a chain, for example. However any 'auto' actions always have $c->state +forced to be set to 0, which is the way its been for a long time, this way an +auto action is required to return 1 to pass the match. It also exists to maintain +compatibility with anyone that exits an auto action with a detach (which is not a +documented way to excape matching, but exists in the wild since it worked as a +side effect of the code for a long time). + +Additionally, upon $c->detach we also force set state to 0. + +Version 5.90102 contains a version of this change but its considered buggy, so +that is a version to avoid. + =head2 VERSION 5.90100 Support for type constraints in Args and CaptureArgs has been improved. You may diff --git a/t/state.t b/t/state.t index 10542b7..f071ec1 100644 --- a/t/state.t +++ b/t/state.t @@ -19,7 +19,10 @@ use HTTP::Request::Common; sub auto :Action { my ($self, $c) = @_; - Test::More::is($c->state, 'begin'); # default state of 1 is new to 9.0102 + # Even if a begin returns something, we kill it. Need to + # do this since there's actually people doing detach in + # auto and expect that to work the same as 0. + Test::More::is($c->state, '0'); return 'auto'; }