In attachment is provided the patch that fixes the issue caused by escaping feature of SimpleXMLElement when wrapping description in .

In Unfuddle class in method createTicket(...), description node is created as $xml->addChild('description', ''). Problem is that SimpleXMLElement escapes the content before attaching to xml and creates '<![CDATA[...]]>' from that. In attachment is method createTicket(...) that uses dom_import_simplexml and createCDATASection as description node and appends it to original xml.

Patch
Replace the Original method createTicket(...) in Unfuddle class with new from attachment.

Thank you

Comments

jody lynn’s picture

Status: Active » Needs work

Rename new variable $no to something more descriptive

Generate a real patch with git

barancekk’s picture

StatusFileSize
new1.52 KB

Thank you for the comments. I changed the name of variable and created real patch which is in attachment.

dags’s picture

+++ b/unfuddle_api.classes.incundefined
@@ -316,7 +316,14 @@ class Unfuddle {
+
+    // SimpleXMLElement do not have an easy way to wrap content with
+    // <![CDATA[...]]>. We need to do it with dom_import_simplexml.
+    $xml->description = NULL;
+    $description_node = dom_import_simplexml($xml->description);
+    $description_node_owner   = $description_node->ownerDocument;
+    $description_node->appendChild($description_node_owner->createCDATASection($description));

What does this do? I think we need a better comment here to explain why we're setting $xml->description to NULL and then passing it to dom_import_simplexml().

+++ b/unfuddle_api.classes.incundefined
@@ -316,7 +316,14 @@ class Unfuddle {
diff --git a/unfuddle_api.info b/unfuddle_api.info

diff --git a/unfuddle_api.info b/unfuddle_api.info
old mode 100644
new mode 100755
index 9b48676..0a69233

index 9b48676..0a69233
--- a/unfuddle_api.info

--- a/unfuddle_api.info
+++ b/unfuddle_api.infoundefined

+++ b/unfuddle_api.infoundefined
+++ b/unfuddle_api.infoundefined
@@ -5,3 +5,10 @@ files[] = unfuddle_api.module

@@ -5,3 +5,10 @@ files[] = unfuddle_api.module
 files[] = unfuddle_api.install
 files[] = unfuddle_api.classes.inc
 
+
+; Information added by drupal.org packaging script on 2011-04-19
+version = "7.x-1.x-dev"
+core = "7.x"
+project = "unfuddle_api"
+datestamp = "1303173839"
+
diff --git a/unfuddle_api.install b/unfuddle_api.install

diff --git a/unfuddle_api.install b/unfuddle_api.install
old mode 100644
new mode 100755
diff --git a/unfuddle_api.module b/unfuddle_api.module

diff --git a/unfuddle_api.module b/unfuddle_api.module
old mode 100644

This portion should not be included in the patch. This is information that is dynamically generated and added by the Drupal packaging system. Use `git add -p` to create a patch with only the code changes you want.

barancekk’s picture

StatusFileSize
new1.09 KB

Thank you very much for all comments.

I created a new patch with more descriptive comment about creating CDATA section. Text describes the whole process from creating an empty description SimpleXML node to using DOM to create CDATA section and biding it to description node. Patch is in attachment.

Karol

jody lynn’s picture

Status: Needs work » Fixed

Patch committed to 7.x-1.x. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.