diff options
author | mkanat%bugzilla.org <> | 2008-04-08 06:54:20 +0200 |
---|---|---|
committer | mkanat%bugzilla.org <> | 2008-04-08 06:54:20 +0200 |
commit | d7b151f21a9d8faea0a34b7a8b73115c54475840 (patch) | |
tree | 436b436d3d0f610e9effea69631f33750f3227cb | |
parent | a6750cb099ae88ffe3ac7de44ca0e63c87e8542e (diff) | |
download | bugzilla-d7b151f21a9d8faea0a34b7a8b73115c54475840.tar.gz bugzilla-d7b151f21a9d8faea0a34b7a8b73115c54475840.tar.xz |
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
-rwxr-xr-x | Bugzilla/WebService.pm | 37 | ||||
-rwxr-xr-x | xmlrpc.cgi | 1 |
2 files changed, 36 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 diff --git a/xmlrpc.cgi b/xmlrpc.cgi index 2ac34e675..a802ac43f 100755 --- a/xmlrpc.cgi +++ b/xmlrpc.cgi @@ -20,6 +20,7 @@ use lib qw(. lib); use Bugzilla; use Bugzilla::Constants; +use Bugzilla::Error; use Bugzilla::Hook; # Use an eval here so that runtests.pl accepts this script even if SOAP-Lite |