<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PHP SDK bug with setting extraOptions string for CIM in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/PHP-SDK-bug-with-setting-extraOptions-string-for-CIM/m-p/26600#M14126</link>
    <description>&lt;P&gt;I can confirm this.&lt;/P&gt;&lt;P&gt;There is a bug.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The simplier way to fix it is to change:&lt;/P&gt;&lt;P&gt;$this-&amp;gt;_xml-&amp;gt;addChild("extraOptions");&amp;nbsp;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;$this-&amp;gt;_xml-&amp;gt;addChild("extraOptions", '');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Weird thing that Authorize.net still didn't do anything about it.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 19 May 2012 18:47:04 GMT</pubDate>
    <dc:creator>undsoft</dc:creator>
    <dc:date>2012-05-19T18:47:04Z</dc:date>
    <item>
      <title>PHP SDK bug with setting extraOptions string for CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/PHP-SDK-bug-with-setting-extraOptions-string-for-CIM/m-p/10488#M6722</link>
      <description>&lt;P&gt;There's a bug in AuthorizeNetCIM::_setPostString() method. On my PHP installation, the empty extraOptions tag is being rendered as&lt;/P&gt;&lt;PRE&gt;&amp;lt;extraOptions/&amp;gt;&lt;/PRE&gt;&lt;P&gt;That doesn't match the str_replace call. Since both versions are valid XML, here's a patch that uses the DOM API to add the CDATA section:&lt;/P&gt;&lt;PRE&gt;diff --git lib/AuthorizeNetCIM.php lib/AuthorizeNetCIM.php
index 653e731..379ec02 100644
--- lib/AuthorizeNetCIM.php
+++ lib/AuthorizeNetCIM.php
@@ -339,8 +339,10 @@ class AuthorizeNetCIM extends AuthorizeNetRequest
         
         // Add extraOptions CDATA
         if ($this-&amp;gt;_extraOptions) {
-            $this-&amp;gt;_xml-&amp;gt;addChild("extraOptions");
-            $this-&amp;gt;_post_string = str_replace("",'' . $this-&amp;gt;_extraOptions . '', $this-&amp;gt;_xml-&amp;gt;asXML());
+            $dom = dom_import_simplexml($this-&amp;gt;_xml);
+            $extraOptions = $dom-&amp;gt;appendChild($dom-&amp;gt;ownerDocument-&amp;gt;createElement("extraOptions"));
+            $extraOptions-&amp;gt;appendChild($dom-&amp;gt;ownerDocument-&amp;gt;createCDATASection($this-&amp;gt;_extraOptions));
+            $this-&amp;gt;_post_string = $this-&amp;gt;_xml-&amp;gt;asXML();
         }
     }
     &lt;/PRE&gt;I don't see a public bug tracker anywhere, but if there is please point me to it and I'll file an issue.</description>
      <pubDate>Mon, 21 Feb 2011 19:23:44 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/PHP-SDK-bug-with-setting-extraOptions-string-for-CIM/m-p/10488#M6722</guid>
      <dc:creator>deviantintegral</dc:creator>
      <dc:date>2011-02-21T19:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: PHP SDK bug with setting extraOptions string for CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/PHP-SDK-bug-with-setting-extraOptions-string-for-CIM/m-p/10496#M6726</link>
      <description>Looks like the editor munged my patch. Let's try this again.&lt;PRE&gt;diff --git lib/AuthorizeNetCIM.php lib/AuthorizeNetCIM.php
index 653e731..379ec02 100644
--- lib/AuthorizeNetCIM.php
+++ lib/AuthorizeNetCIM.php
@@ -339,8 +339,10 @@ class AuthorizeNetCIM extends AuthorizeNetRequest
         
         // Add extraOptions CDATA
         if ($this-&amp;gt;_extraOptions) {
-            $this-&amp;gt;_xml-&amp;gt;addChild("extraOptions");
-            $this-&amp;gt;_post_string = str_replace("&amp;lt;extraOptions&amp;gt;&amp;lt;/extraOptions&amp;gt;",'&amp;lt;extraOptions&amp;gt;&amp;lt;![CDATA[' . $this-&amp;gt;_extraOptions . ']]&amp;gt;&amp;lt;/extraOptions&amp;gt;', $this-&amp;gt;_xml-&amp;gt;asXML());
+            $dom = dom_import_simplexml($this-&amp;gt;_xml);
+            $extraOptions = $dom-&amp;gt;appendChild($dom-&amp;gt;ownerDocument-&amp;gt;createElement("extraOptions"));
+            $extraOptions-&amp;gt;appendChild($dom-&amp;gt;ownerDocument-&amp;gt;createCDATASection($this-&amp;gt;_extraOptions));
+            $this-&amp;gt;_post_string = $this-&amp;gt;_xml-&amp;gt;asXML();
         }
     }
     &lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Feb 2011 19:40:18 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/PHP-SDK-bug-with-setting-extraOptions-string-for-CIM/m-p/10496#M6726</guid>
      <dc:creator>deviantintegral</dc:creator>
      <dc:date>2011-02-21T19:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: PHP SDK bug with setting extraOptions string for CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/PHP-SDK-bug-with-setting-extraOptions-string-for-CIM/m-p/26600#M14126</link>
      <description>&lt;P&gt;I can confirm this.&lt;/P&gt;&lt;P&gt;There is a bug.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The simplier way to fix it is to change:&lt;/P&gt;&lt;P&gt;$this-&amp;gt;_xml-&amp;gt;addChild("extraOptions");&amp;nbsp;&lt;/P&gt;&lt;P&gt;to&lt;/P&gt;&lt;P&gt;$this-&amp;gt;_xml-&amp;gt;addChild("extraOptions", '');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Weird thing that Authorize.net still didn't do anything about it.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 19 May 2012 18:47:04 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/PHP-SDK-bug-with-setting-extraOptions-string-for-CIM/m-p/26600#M14126</guid>
      <dc:creator>undsoft</dc:creator>
      <dc:date>2012-05-19T18:47:04Z</dc:date>
    </item>
  </channel>
</rss>

