diff options
author | mkanat%bugzilla.org <> | 2008-04-08 04:54:20 +0000 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2008-04-08 04:54:20 +0000 |
commit | d7b151f21a9d8faea0a34b7a8b73115c54475840 (patch) | |
tree | 436b436d3d0f610e9effea69631f33750f3227cb /Bugzilla | |
parent | a6750cb099ae88ffe3ac7de44ca0e63c87e8542e (diff) | |
download | bugs-d7b151f21a9d8faea0a34b7a8b73115c54475840.tar bugs-d7b151f21a9d8faea0a34b7a8b73115c54475840.tar.gz bugs-d7b151f21a9d8faea0a34b7a8b73115c54475840.tar.bz2 bugs-d7b151f21a9d8faea0a34b7a8b73115c54475840.tar.xz bugs-d7b151f21a9d8faea0a34b7a8b73115c54475840.zip |
Bug 415796: All webservice methods were failing if a string had multibyte characters in it, due to bugs in SOAP::Lite.
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla')
-rwxr-xr-x | Bugzilla/WebService.pm | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/Bugzilla/WebService.pm b/Bugzilla/WebService.pm index dddc87a15..72994cb65 100755 --- a/Bugzilla/WebService.pm +++ b/Bugzilla/WebService.pm @@ -48,10 +48,19 @@ sub handle_login { Bugzilla->login; } -package Bugzilla::WebService::XMLRPC::Transport::HTTP::CGI; +1; +package Bugzilla::WebService::XMLRPC::Transport::HTTP::CGI; use strict; -eval 'use base qw(XMLRPC::Transport::HTTP::CGI)'; +eval { require XMLRPC::Transport::HTTP; }; +our @ISA = qw(XMLRPC::Transport::HTTP::CGI); + +sub initialize { + my $self = shift; + my %retval = $self->SUPER::initialize(@_); + $retval{'serializer'} = Bugzilla::WebService::XMLRPC::Serializer->new; + return %retval; +} sub make_response { my $self = shift; @@ -67,6 +76,30 @@ sub make_response { 1; +# This package exists to fix a UTF-8 bug in SOAP::Lite. +# See http://rt.cpan.org/Public/Bug/Display.html?id=32952. +package Bugzilla::WebService::XMLRPC::Serializer; +use strict; +# We can't use "use base" because XMLRPC::Serializer doesn't return +# a true value. +eval { require XMLRPC::Lite; }; +our @ISA = qw(XMLRPC::Serializer); + +sub new { + my $class = shift; + my $self = $class->SUPER::new(@_); + # This fixes UTF-8. + $self->{'_typelookup'}->{'base64'} = + [10, sub { !utf8::is_utf8($_[0]) && $_[0] =~ /[^\x09\x0a\x0d\x20-\x7f]/}, + 'as_base64']; + # This makes arrays work right even though we're a subclass. + # (See http://rt.cpan.org//Ticket/Display.html?id=34514) + $self->{'_encodingStyle'} = ''; + return $self; +} + +1; + __END__ =head1 NAME |