-- kabel <[EMAIL PROTECTED]> wrote
(on Wednesday, 02 April 2008, 03:59 PM -0400):
> In Zend_XmlRpc_Value::_stripXmlDeclaration(), the regular expression that
> seems to be used to strip off the header has a trailing 'u' in it that may be
> returning unexpected results. The line in question is:
>
> return preg_replace('/<\?xml version="1.0"( encoding="[^\"]*")?\?>\n/u', '',
> $dom->saveXML());
>
> With the u, the call returns nothing. Without it, it returns expected
> values.
>
> Example:
>
> INPUT:
> <?xml version="1.0"?>
> <value><struct><member><name>faultCode</name></member><member><name>faultString</name></member></struct></value>
>
> With "u" returns nothing
>
> Without "u" returns
> <value><struct><member><name>faultCode</name></member><member><name>faultString</name></member></struct></value>
>
>
> Any thoughts? Is this something involving Perl regexes that we're missing?
The 'u' switch is for unicode mode, and Zend_XmlRpc tries to play nice
with Unicode. The switch is available for all versions of PHP 5, and
cannot be turned off at compile time.
HOWEVER, if your string has invalid UTF-8 sequences, then there's an
unfortunate side effect: the preg functions fail silently. (There's a
nice writeup on this in a comment on
http://us2.php.net/manual/en/reference.pcre.pattern.modifiers.php.)
You don't indicate if you're using the XmlRpc_Client or _Server, but I'd
check whatever you're passing to the class in question to see if perhaps
it's not valid UTF-8.
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/