Issues

ZF-3947: Zend_XmlRpc_Value ignores empty strings as struct values

Issue Type: Bug Created: 2008-08-13T19:59:44.000+0000 Last Updated: 2008-12-21T05:59:34.000+0000 Status: Resolved Fix version(s): - 1.7.1 (01/Dec/08)

Reporter: James Lucas (mjlucas) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_XmlRpc_Client

Related issues: - ZF-3862

Attachments:

Description

I have a Java based XMLRPC server which sends back a struct from a method call. In this struct there can be many key/value pairs where the value is a blank string.

These blank strings don't get added to the returned struct (array). The check 'empty($member->value)' is catching this case and preventing the value from being added to the struct. From reading the spec this is perfectly valid. An example XML (part) output is

<pre class="highlight">
address

which should be valid because if no type is defined in between then string is assumed. (Similar discussion http://framework.zend.com/issues/browse/ZF-1364)

The relavent code is Zend/XmlRpc/Value.php:371

<pre class="highlight">
               // Parse all the memebers of the struct from the XML string
               // (simple xml element) to Zend_XmlRpc_Value objects
               foreach ($value->member as $member) {
                   // @todo? If a member doesn't have a  tag, we don't add it to the struct
                   // Maybe we want to throw an exception here ?
                   if ((!$member->value instanceof SimpleXMLElement) || empty($member->value)) {
                       continue;
                       //throw new Zend_XmlRpc_Value_Exception('Member of the '. self::XMLRPC_TYPE_STRUCT .' XML-RPC native type must contain a VALUE tag');
                   }
                   $values[(string)$member->name] = self::_xmlStringToNativeXmlRpc($member->value);
               } 

Comments

Posted by Benjamin Eberlei (beberlei) on 2008-11-07T04:00:11.000+0000

It seems these two issues are somehow related.

Posted by James Lucas (mjlucas) on 2008-11-17T17:35:15.000+0000

After upgrading to 1.7 I would like to revisit this bug report. This bug still exist and really should be fixed as it causes the silent removal of data returned in a xmlrpc query. The use of "empty" not only discards a empty string (which is valid) but also discards a string with the value "0" (that's a zero)

The @todo needs to be removed because it is incorrect and the "|| empty($member->value)" needs to be removed. This ensures that we still have valid XML (value tag inside a member tag) but correct values are still added to the struct.

I also don't know why this issue has been listed as dependant on issue ZF-3862 as it is not related.

Posted by James Lucas (mjlucas) on 2008-11-17T17:36:53.000+0000

I have raised this to critical because the bug is silently dropping data from a return result which is valid.

Posted by Matthew Weier O'Phinney (matthew) on 2008-11-20T10:22:53.000+0000

Fixed in trunk with r12720 and in 1.7 release branch with r12721.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts