#59513, XML-RPC struct spawns empty parameters, patch by chx

4.7.x
Gerhard Killesreiter 2006-04-24 10:49:38 +00:00
parent 85a8558117
commit 0e8a3c1344
1 changed files with 8 additions and 2 deletions

View File

@ -165,6 +165,7 @@ function xmlrpc_message_get() {
function xmlrpc_message_tag_open($parser, $tag, $attr) { function xmlrpc_message_tag_open($parser, $tag, $attr) {
$xmlrpc_message = xmlrpc_message_get(); $xmlrpc_message = xmlrpc_message_get();
$xmlrpc_message->current_tag_contents = ''; $xmlrpc_message->current_tag_contents = '';
$xmlrpc_message->last_open = $tag;
switch($tag) { switch($tag) {
case 'methodCall': case 'methodCall':
case 'methodResponse': case 'methodResponse':
@ -213,8 +214,13 @@ function xmlrpc_message_tag_close($parser, $tag) {
$value_flag = TRUE; $value_flag = TRUE;
break; break;
case 'value': case 'value':
$value = (string)$xmlrpc_message->current_tag_contents; // If no type is indicated, the type is string.
$value_flag = TRUE; // We take special care for empty values
if (trim($xmlrpc_message->current_tag_contents) != '' || $xmlrpc_message->last_open == 'value') {
$value = (string)$xmlrpc_message->current_tag_contents;
$value_flag = TRUE;
}
unset($xmlrpc_message->last_open);
break; break;
case 'boolean': case 'boolean':
$value = (boolean)trim($xmlrpc_message->current_tag_contents); $value = (boolean)trim($xmlrpc_message->current_tag_contents);