Invalid xml due to incorrectly encoded greater-than symbol

kehan - July 24, 2008 - 13:54
Project:Views Datasource
Version:5.x-1.0-alpha2
Component:Code
Category:bug report
Priority:normal
Assigned:allisterbeharry
Status:reviewed & tested by the community
Description

Using the raw_xml output option results in invalid xml code - there's a typo in the code

<?php
  $output
= str_replace('<', '&lt;', $output); //encode left angle bracket
 
$output = str_replace('>', '&rt;', $output); //encode right angle bracket
?>

should read
<?php
  $output
= str_replace('<', '&lt;', $output); //encode less than
 
$output = str_replace('>', '&gt;', $output); //encode greater than
?>

There's similar code in the other views_datasource modules and this also needs fixing.

#1

ksenzee - March 12, 2009 - 20:58
Version:5.x-1.0-alpha1» 5.x-1.0-alpha2
Status:active» needs review

@kehan - Thanks for tracking this down. It saved me a bunch of time.

Here's a patch rolled against 5.x-1.0-alpha2 that fixes this bug in all the views_datasource modules.

AttachmentSize
286715_invalid_xml.patch 2.57 KB

#2

allisterbeharry - April 19, 2009 - 05:29
Assigned to:Anonymous» allisterbeharry

Thanks. Will be fixed in the next release.

#3

dalin - September 18, 2009 - 03:51
Status:needs review» reviewed & tested by the community

Confirmed that the patch works and is an appropriate fix.

#4

dalin - September 18, 2009 - 03:55
Title:Invalid xml» Invalid xml due to incorrectly encoded greater-than symbol

#5

volocuga - December 1, 2009 - 18:48

Another typo:

Views_xml module (may be not only here):

Line 215 $output = str_replace("'", '&pos;', $output); //encode apostrophe

Should be

$output = str_replace("'", '&apos;', $output); //encode apostrophe

 
 

Drupal is a registered trademark of Dries Buytaert.