[wp-hackers] ClassIXR.php problem
unteins at gmail.com
Sat Aug 27 13:38:49 GMT 2005
For those of you who have no idea who I am, I develop the Live+Press
plugin for synching WordPress and LiveJournal. I ran into a problem
with WordPress 1.2 about a year ago involving the class-IXR.php.
Michel V. asked me to get in touch with Simon and I wrote him
essentially the following e-mail. I got no response, but since the
library is still breaking in my plugin, I need to address the issue to
the greater community now.
Here is what happens and what I did that appears to fix the problem:
I am using the XMLRPC client to get information from Live Journals
XMLRPC server (http://www.livejournal.com/doc/server/ljp.csp.xml-rpc.protocol.html)
using the login method. If the response contains very large amounts of
data, it appears the it is broken into lines (from reading the source
it looks like the break is every 4096 bytes) and a line break is
When this is parsed into an array, it appears that the extra line
breaks are causing a problem and the array is not being created. When
I try to use the array PHP tells me that it doesn't exist. If the data
returned is small, then the extra line breaks aren't inserted and
everything seems to be ok.
I used the debug mode to dump the xml to the browser and I can see
that the xml dumped to the browser has a line break in the middle of
an xml entity. If I save the xml to a file and try to open it in an
xml reader, I get an error saying that it is not well formed. If I
remove the extra line breaks, then the xml reader will open the file.
Fix: On line 529 of the classIXR.php file I changed
from: $contents .= trim($line)."\n";
to: $contents .= trim($line);
I am not sure if my fix is valid or not, it seems to solve the problem
in this case and doesn't appear to cause any additional problems, but
I am not familiar enough with XMLRPC to really evaluate whether or not
that is generally true.
If this is valid, how do we get it moved into the WordPress
distribution so that this issue dies once and for all. I have been
telling people to overwrite the file with my edit at their own risk,
which as you can imagine doesn't inspire great confidence.
Unteins (Jason Goldsmith)
More information about the wp-hackers