File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -91,14 +91,10 @@ private function buildXML(array $params = array())
9191 $ upload_item ->addChild ($ upload_k , $ upload_v );
9292 }
9393 }
94- } elseif ('description ' === $ k && (strpos ($ v , "\n" ) !== false || strpos ($ v , PHP_EOL ) !== false )) {
95- // surround the description with CDATA if there is any '\n' in the description
96- $ node = $ xml ->addChild ($ k );
97- $ domNode = dom_import_simplexml ($ node );
98- $ no = $ domNode ->ownerDocument ;
99- $ domNode ->appendChild ($ no ->createCDATASection ($ v ));
10094 } else {
101- $ xml ->addChild ($ k , $ v );
95+ // "addChild" does not escape text for XML value, but the setter does.
96+ // http://stackoverflow.com/a/555039/99904
97+ $ xml ->$ k = $ v ;
10298 }
10399 }
104100
Original file line number Diff line number Diff line change @@ -135,8 +135,8 @@ public function testCreateComplexWithLineBreakInDescription()
135135 $ xml = '<?xml version="1.0"?>
136136<issue>
137137 <subject>test api (xml) 3</subject>
138- <description><![CDATA[ line1
139- line2]]> </description>
138+ <description>line1
139+ line2</description>
140140 <project_id>test</project_id>
141141 <assigned_to_id>1</assigned_to_id>
142142 <custom_fields type="array">
You can’t perform that action at this time.
0 commit comments