[Catalyst] Catalyst crashing hard with UTF-8 string

Tomas Doran bobtfish at bobtfish.net
Wed Jul 8 21:29:30 GMT 2009


On 8 Jul 2009, at 18:01, Paul Makepeace wrote:

>> You know it's dieing inside TT, right? So you can Data::Dumper the  
>> input
>> which causes it to die to a file, write a program that instantiates
>> View::TT, calls ->render with the same input (and template), and  
>> that should
>> crap out in the same way?
>
> Ya, I was kinda hoping you wouldn't say this, and that there was a way
> to catch whatever was happening in Catalyst or trace the execution
> path to get to the point where the things actually dieing.

Well, start by throwing Devel::SimpleTrace, or Carp::Always at it to  
get a strack trace.

MyApp::View::TT->render is going to get called, so add something like  
this to that class:

use Data::Dumper;
sub render {
     my ($self, $c, $template, $args) = @_;
     local $Data::Dumper::Maxdepth = 4;
     warn Dumper([$template, $args]);
     $self->next::method($c, $template, $args);
}

increase Maxdepth if needed until it pukes..

You should literally be able to dump the Dumper glob into a .t file,  
and build a test around it....

use MyApp;
use MyApp::View::TT;

my $view = MyApp::View::TT->new(%config_your_app_gives_TT_view);
my $VAR! = # Dumper crap here

my ($template, $args) = @$VAR1;

$view->render('MyApp', $template, $args); # Should blow up, in the  
'correct' way..

Cutting template / data down to smallest replicable size and throwing  
away Catalyst app and using raw TT should be easy from there forwards :)

Another thought - have you tried disabling the XS stash for TT? (IIRC  
there is an env var to do this) and seeing if that affects the crash?

Cheers
t0m




More information about the Catalyst mailing list