[Catalyst] get_locale Bug

Stefan Profanter catalyst at s.profanter.me
Sat Aug 13 17:37:04 GMT 2011


Hi,

i've found a bug in CatalystX::I18N::Role::GetLocale when using the function

$c->get_locale();

 

If you set the User-Agent manually to something invalid with two words,
separated with a minus, the whole Server crashes.

Eg. use http://www.rexswain.com/httpview.html and set User-Agent to
"hidden-agent" and connect to a Server which is using get_locale(), Catalyst
crashes with an error (see below).

 

Could you help me correcting the bug?

 

Thanks

Stefan

 

Error Output:

Caught exception in MyApp::Controller::Root->auto "Attribute
(browser_language) does not pass the type constraint because: Validation
failed for 'Maybe[CatalystX::I18N::Type::Language]' with value nagios at
accessor Moose::Meta::Class::__ANON__::SERIAL::19::browser_language (defined
at /usr/local/share/perl/5.10.1/CatalystX/I18N/TraitFor/Request.pm line 20)
line 18

 
Moose::Meta::Class::__ANON__::SERIAL::19::browser_language('Moose::Meta::Cla
ss::__ANON__::SERIAL::19=HASH(0x1b1b5508)') called at
/usr/local/share/perl/5.10.1/CatalystX/I18N/Role/GetLocale.pm line 74

 
CatalystX::I18N::Role::GetLocale::get_locale_from_browser('MyApp=HASH(0x1ae7
9638)') called at
/usr/local/share/perl/5.10.1/CatalystX/I18N/Role/GetLocale.pm line 153

 
CatalystX::I18N::Role::GetLocale::get_locale('MyApp=HASH(0x1ae79638)')
called at /home/stefan/MyApp/script/../lib/MyApp/Controller/Root.pm line 48

 
MyApp::Controller::Root::auto('MyApp::Controller::Root=HASH(0x1af57148)',
'MyApp=HASH(0x1ae79638)') called at
/usr/local/share/perl/5.10.1/Catalyst/Action.pm line 65

 
Catalyst::Action::execute('Catalyst::Action=HASH(0x1b07ee68)',
'MyApp::Controller::Root=HASH(0x1af57148)', 'MyApp=HASH(0x1ae79638)') called
at /usr/local/share/perl/5.10.1/Catalyst.pm line 1668

                eval {...} called at
/usr/local/share/perl/5.10.1/Catalyst.pm line 1668

                Catalyst::execute('MyApp=HASH(0x1ae79638)',
'MyApp::Controller::Root', 'Catalyst::Action=HASH(0x1b07ee68)') called at
/usr/local/share/perl/5.10.1/Catalyst/Action.pm line 60

 
Catalyst::Action::dispatch('Catalyst::Action=HASH(0x1b07ee68)',
'MyApp=HASH(0x1ae79638)') called at
/usr/local/share/perl/5.10.1/Catalyst/Controller.pm line 117

 
Catalyst::Controller::_AUTO('MyApp::Controller::Root=HASH(0x1af57148)',
'MyApp=HASH(0x1ae79638)') called at
/usr/local/share/perl/5.10.1/Catalyst/Action.pm line 65

 
Catalyst::Action::execute('Catalyst::Action=HASH(0x1b07cf58)',
'MyApp::Controller::Root=HASH(0x1af57148)', 'MyApp=HASH(0x1ae79638)') called
at /usr/local/share/perl/5.10.1/Catalyst.pm line 1668

                eval {...} called at
/usr/local/share/perl/5.10.1/Catalyst.pm line 1668

                Catalyst::execute('MyApp=HASH(0x1ae79638)',
'MyApp::Controller::Root', 'Catalyst::Action=HASH(0x1b07cf58)') called at
/usr/local/share/perl/5.10.1/Catalyst/Action.pm line 60

 
Catalyst::Action::dispatch('Catalyst::Action=HASH(0x1b07cf58)',
'MyApp=HASH(0x1ae79638)') called at
/usr/local/share/perl/5.10.1/Catalyst/Dispatcher.pm line 257

 
Catalyst::Dispatcher::_do_forward('Catalyst::Dispatcher=HASH(0x19ede418)',
'forward', 'MyApp=HASH(0x1ae79638)', '_AUTO') called at
/usr/local/share/perl/5.10.1/Catalyst/Dispatcher.pm line 237

 
Catalyst::Dispatcher::forward('Catalyst::Dispatcher=HASH(0x19ede418)',
'MyApp=HASH(0x1ae79638)', '_AUTO') called at
/usr/local/share/perl/5.10.1/Catalyst.pm line 377

                Catalyst::forward('MyApp=HASH(0x1ae79638)', '_AUTO') called
at /usr/local/share/perl/5.10.1/Catalyst/Controller.pm line 99

 
Catalyst::Controller::_DISPATCH('MyApp::Controller::Root=HASH(0x1af57148)',
'MyApp=HASH(0x1ae79638)') called at
/usr/local/share/perl/5.10.1/Catalyst/Action.pm line 65

 
Catalyst::Action::execute('Catalyst::Action=HASH(0x1b06c4e0)',
'MyApp::Controller::Root=HASH(0x1af57148)', 'MyApp=HASH(0x1ae79638)') called
at /usr/local/share/perl/5.10.1/Catalyst.pm line 1668

                eval {...} called at
/usr/local/share/perl/5.10.1/Catalyst.pm line 1668

                Catalyst::execute('MyApp=HASH(0x1ae79638)',
'MyApp::Controller::Root', 'Catalyst::Action=HASH(0x1b06c4e0)') called at
/usr/local/share/perl/5.10.1/Catalyst/Action.pm line 60

 
Catalyst::Action::dispatch('Catalyst::Action=HASH(0x1b06c4e0)',
'MyApp=HASH(0x1ae79638)') called at
/usr/local/share/perl/5.10.1/Catalyst/Dispatcher.pm line 257

 
Catalyst::Dispatcher::_do_forward('Catalyst::Dispatcher=HASH(0x19ede418)',
'forward', 'MyApp=HASH(0x1ae79638)', '//_DISPATCH') called at
/usr/local/share/perl/5.10.1/Catalyst/Dispatcher.pm line 237

 
Catalyst::Dispatcher::forward('Catalyst::Dispatcher=HASH(0x19ede418)',
'MyApp=HASH(0x1ae79638)', '//_DISPATCH') called at
/usr/local/share/perl/5.10.1/Catalyst.pm line 377

                Catalyst::forward('MyApp=HASH(0x1ae79638)', '//_DISPATCH')
called at /usr/local/share/perl/5.10.1/Catalyst/Dispatcher.pm line 105

 
Catalyst::Dispatcher::dispatch('Catalyst::Dispatcher=HASH(0x19ede418)',
'MyApp=HASH(0x1ae79638)') called at /usr/local/share/perl/5.10.1/Catalyst.pm
line 1614

                Catalyst::dispatch('MyApp=HASH(0x1ae79638)') called at
/usr/local/share/perl/5.10.1/Catalyst/Plugin/Static/Simple.pm line 76

                Class::MOP::Class:::around('CODE(0x198cf630)',
'MyApp=HASH(0x1ae79638)') called at
/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm line 162

 
Class::MOP::Method::Wrapped::__ANON__('MyApp=HASH(0x1ae79638)') called at
/usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm line 91

                MyApp::dispatch('MyApp=HASH(0x1ae79638)') called at
/usr/local/share/perl/5.10.1/Catalyst.pm line 1955

                eval {...} called at
/usr/local/share/perl/5.10.1/Catalyst.pm line 1946

                Catalyst::handle_request('MyApp', 'env', 'HASH(0x1a8c44d8)')
called at /usr/local/share/perl/5.10.1/Catalyst/Engine/HTTP.pm line 395

 
Catalyst::Engine::HTTP::_handler('Catalyst::Engine::HTTP=HASH(0x19ec50e0)',
'MyApp', 3000, 'GET', '/', 'HTTP/1.1') called at
/usr/local/share/perl/5.10.1/Catalyst/Engine/HTTP.pm line 292

 
Catalyst::Engine::HTTP::run('Catalyst::Engine::HTTP=HASH(0x19ec50e0)',
'MyApp', 3000, undef, 'HASH(0x19ad27f8)') called at
/usr/local/share/perl/5.10.1/Catalyst.pm line 2399

                Catalyst::run('MyApp', 3000, undef, 'HASH(0x19ad27f8)')
called at /usr/local/share/perl/5.10.1/Catalyst/ScriptRole.pm line 49

 
Catalyst::ScriptRole::_run_application('Catalyst::Script::Server=HASH(0x1929
fbc0)') called at /usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm
line 142

                Catalyst::Script::Server::__ANON__() called at
/usr/local/share/perl/5.10.1/Catalyst/Restarter/Forking.pm line 20

 
Catalyst::Restarter::Forking::_fork_and_start('Catalyst::Restarter::Forking=
HASH(0x19ad2528)') called at
/usr/local/share/perl/5.10.1/Catalyst/Restarter.pm line 141

 
Catalyst::Restarter::_handle_events('Catalyst::Restarter::Forking=HASH(0x19a
d2528)', 'File::ChangeNotify::Event=HASH(0x19b03650)') called at
/usr/local/share/perl/5.10.1/Catalyst/Restarter.pm line 105

 
Catalyst::Restarter::_restart_on_changes('Catalyst::Restarter::Forking=HASH(
0x19ad2528)') called at /usr/local/share/perl/5.10.1/Catalyst/Restarter.pm
line 93

 
Catalyst::Restarter::run_and_watch('Catalyst::Restarter::Forking=HASH(0x19ad
2528)') called at /usr/local/share/perl/5.10.1/Catalyst/Script/Server.pm
line 189

 
Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x1929fbc0)')
called at /usr/local/share/perl/5.10.1/Catalyst/ScriptRunner.pm line 20

                Catalyst::ScriptRunner::run('Catalyst::ScriptRunner',
'MyApp', 'Server') called at /home/stefan/MyApp/script/myapp_server.pl line
8"

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20110813/697ec8fc/attachment.htm


More information about the Catalyst mailing list