Commit d7b151f2 authored by mkanat%bugzilla.org's avatar mkanat%bugzilla.org

Bug 415796: All webservice methods were failing if a string had multibyte…

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
parent a6750cb0
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment