Bug fix: Newlines in XML

Posted on Thursday 11 August 2005

There was a bug in the XML class that was causing it to strip newlines out of fields (a photo's description, for example). Below is the fix that you can apply to xml.php to fix it. I've also updated it in CVS so that it will appear in the next update. The only place where this doesn't quite work is if someone puts a newline at the very beginning of the description. That will still get chopped out, but that's a fairly minor issue.

xml.php
Change lines 27-28 to:
   var $_replace = array('°','&',"\n");
   var $_replaceWith = array('{deg}', '{amp}', '{lf}');

After line 42 which reads as:
       $xml = str_replace($this->_replace, $this->_replaceWith, $xml);
Add this line:
       $xml = str_replace(">{lf}", ">\n", $xml);


No comments have been added to this post yet.

Leave a comment

(required)

(required)


Information for comment users
Line and paragraph breaks are implemented automatically. Your e-mail address is never displayed. Please consider what you're posting.

Use the buttons below to customise your comment.


RSS feed for comments on this post | TrackBack URI