Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
522e0849
Commit
522e0849
authored
May 18, 2009
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 477593: Make the WebService send <nil/> for undef values
Patch by Rosie Clarkson <rosie.clarkson@planningportal.gov.uk> r=mkanat, a=mkanat
parent
0c35b2eb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
3 deletions
+44
-3
XMLRPC.pm
Bugzilla/WebService/Server/XMLRPC.pm
+44
-3
No files found.
Bugzilla/WebService/Server/XMLRPC.pm
View file @
522e0849
...
...
@@ -14,6 +14,9 @@
#
# Contributor(s): Marc Schumann <wurblzap@gmail.com>
# Max Kanat-Alexander <mkanat@bugzilla.org>
# Rosie Clarkson <rosie.clarkson@planningportal.gov.uk>
#
# Portions © Crown copyright 2009 - Rosie Clarkson (development@planningportal.gov.uk) for the Planning Portal
package
Bugzilla::WebService::Server::
XMLRPC
;
...
...
@@ -155,6 +158,37 @@ sub as_string {
return
$self
->
SUPER::
as_string
(
$value
);
}
# Here the XMLRPC::Serializer is extended to use the XMLRPC nil extension.
sub
encode_object
{
my
$self
=
shift
;
my
@encoded
=
$self
->
SUPER::
encode_object
(
@_
);
return
$encoded
[
0
]
->
[
0
]
eq
'nil'
?
[
'value'
,
{},
[
@encoded
]]
:
@encoded
;
}
sub
BEGIN
{
no
strict
'refs'
;
for
my
$type
(
qw(double i4 int dateTime)
)
{
my
$method
=
'as_'
.
$type
;
*
$method
=
sub
{
my
(
$self
,
$value
)
=
@_
;
if
(
!
defined
(
$value
))
{
return
as_nil
();
}
else
{
my
$super_method
=
"SUPER::$method"
;
return
$self
->
$super_method
(
$value
);
}
}
}
}
sub
as_nil
{
return
[
'nil'
,
{}];
}
1
;
__END__
...
...
@@ -201,11 +235,18 @@ Normally, XML-RPC does not allow empty values for C<int>, C<double>, or
C<dateTime.iso8601> fields. Bugzilla does--it treats empty values as
C<undef> (called C<NULL> or C<None> in some programming languages).
Bugzilla also accepts a type called C<< <nil> >>, which is always considered
to be C<undef>, no matter what it contains.
Bugzilla also accepts an element called C<< <nil> >>, as specified by the
XML-RPC extension here: L<http://ontosys.com/xml-rpc/extensions.php>, which
is always considered to be C<undef>, no matter what it contains.
Bugzilla uses C<< <nil/> >> values to return C<int>, C<double>, or
C<dateTime.iso8601> values which are undefined.
=begin private
nil is implemented by XMLRPC::Lite, in XMLRPC::Deserializer::decode_value.
nil is implemented by XMLRPC::Lite, in XMLRPC::Deserializer::decode_value
in the CPAN SVN since 14th Dec 2008
L<http://rt.cpan.org/Public/Bug/Display.html?id=20569> and in Fedora's
perl-SOAP-Lite package in versions 0.68-1 and above.
=end private
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment