<?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 Upgrading PHP SDK to PHP 8.1 in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Upgrading-PHP-SDK-to-PHP-8-1/m-p/86442#M54374</link>
    <description>&lt;DIV&gt;I'm part of a development team that manages a website using the Authorize.net PHP SDK. I hope this is the right place to ask questions about this.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The website is currently using v.2.0.2 of the&amp;nbsp;Official PHP SDK for Authorize.Net. Our website uses PHP 7.4 but as this is now end-of-life, we're looking to upgrade to PHP 8.1. We ran some tests using 8.1, but the API threw fatal errors including:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;Error [number 1] During inheritance of JsonSerializable: Uncaught ; File: &lt;EM&gt;folder_name&lt;/EM&gt;/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/MerchantAuthenticationType.php; Line: 11&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;Error [number 8192] Return type of net\authorize\api\contract\v1\MerchantAuthenticationType::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice; File: &lt;EM&gt;folder_name&lt;/EM&gt;/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/MerchantAuthenticationType.php; Line: 261&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;I looked on the Github pages at&amp;nbsp;&lt;A href="https://github.com/AuthorizeNet/sdk-php/" target="_blank" rel="noopener"&gt;https://github.com/AuthorizeNet/sdk-php/&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for an updated version of the code for PHP 8.1 but it looks like 2.0.2 is the latest version. I also saw quite a few people complaining that the code didn't work on PHP 8.1.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'd really appreciate guidance on where to go from here - are there plans to release a fix for PHP 8.1, or is there an easy way I can fix this myself?&amp;nbsp;&lt;/DIV&gt;</description>
    <pubDate>Tue, 09 May 2023 12:49:02 GMT</pubDate>
    <dc:creator>iteracy</dc:creator>
    <dc:date>2023-05-09T12:49:02Z</dc:date>
    <item>
      <title>Upgrading PHP SDK to PHP 8.1</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Upgrading-PHP-SDK-to-PHP-8-1/m-p/86442#M54374</link>
      <description>&lt;DIV&gt;I'm part of a development team that manages a website using the Authorize.net PHP SDK. I hope this is the right place to ask questions about this.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The website is currently using v.2.0.2 of the&amp;nbsp;Official PHP SDK for Authorize.Net. Our website uses PHP 7.4 but as this is now end-of-life, we're looking to upgrade to PHP 8.1. We ran some tests using 8.1, but the API threw fatal errors including:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;Error [number 1] During inheritance of JsonSerializable: Uncaught ; File: &lt;EM&gt;folder_name&lt;/EM&gt;/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/MerchantAuthenticationType.php; Line: 11&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BLOCKQUOTE&gt;&lt;DIV&gt;Error [number 8192] Return type of net\authorize\api\contract\v1\MerchantAuthenticationType::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice; File: &lt;EM&gt;folder_name&lt;/EM&gt;/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/MerchantAuthenticationType.php; Line: 261&lt;/DIV&gt;&lt;/BLOCKQUOTE&gt;&lt;DIV&gt;I looked on the Github pages at&amp;nbsp;&lt;A href="https://github.com/AuthorizeNet/sdk-php/" target="_blank" rel="noopener"&gt;https://github.com/AuthorizeNet/sdk-php/&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for an updated version of the code for PHP 8.1 but it looks like 2.0.2 is the latest version. I also saw quite a few people complaining that the code didn't work on PHP 8.1.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'd really appreciate guidance on where to go from here - are there plans to release a fix for PHP 8.1, or is there an easy way I can fix this myself?&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Tue, 09 May 2023 12:49:02 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Upgrading-PHP-SDK-to-PHP-8-1/m-p/86442#M54374</guid>
      <dc:creator>iteracy</dc:creator>
      <dc:date>2023-05-09T12:49:02Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrading PHP SDK to PHP 8.1</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Upgrading-PHP-SDK-to-PHP-8-1/m-p/87367#M54961</link>
      <description>&lt;P&gt;If anyone with the same problem comes across this message: in the end, we fixed it ourselves without any help from Authorize.net (can you tell how angry I am about their lack of support?). We took the advice of jdpace2 in the Issues section of the Github repo (&lt;A href="https://github.com/AuthorizeNet/sdk-php/issues/440#issuecomment-1622942466" target="_blank"&gt;https://github.com/AuthorizeNet/sdk-php/issues/440#issuecomment-1622942466&lt;/A&gt;&lt;LI-EMOJI id="lia_disappointed-face" title=":disappointed_face:"&gt;&lt;/LI-EMOJI&gt;&lt;BR /&gt;&lt;BR /&gt;Search for all instances of&amp;nbsp;&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&lt;EM&gt;public function jsonSerialize()&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;Replace them with:&lt;/P&gt;&lt;P class="lia-indent-padding-left-60px"&gt;&lt;EM&gt;#[\ReturnTypeWillChange]&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;public function jsonSerialize()&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;This allowed us to move to PHP 8.1 without any issues. It's not a perfect solution, but it works for now.&lt;/P&gt;</description>
      <pubDate>Tue, 22 Aug 2023 10:08:17 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Upgrading-PHP-SDK-to-PHP-8-1/m-p/87367#M54961</guid>
      <dc:creator>iteracy</dc:creator>
      <dc:date>2023-08-22T10:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrading PHP SDK to PHP 8.1</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Upgrading-PHP-SDK-to-PHP-8-1/m-p/88512#M55773</link>
      <description>&lt;P&gt;I encountered a&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;PHP Fatal error&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;when we upgraded to PHP 8.0 from PHP7.4 (&lt;A title="PHP 8 Support for AuthorizeNet/sdk-php" href="https://community.developer.cybersource.com/t5/Integration-and-Testing/PHP-8-Support-for-AuthorizeNet-sdk-php/td-p/75477" target="_blank" rel="noopener"&gt;PHP 8 Support for AuthorizeNet/sdk-php&lt;/A&gt;). Eventually Authorize.net did update the version to 2.0.2 which resolved the error. I am hopeful someone from the Authorize.net development team will bump the version to 2.0.3 and properly resolve the return type issue.&lt;BR /&gt;&lt;BR /&gt;The new issue caused by upgrading to PHP 8.1 from PHP 8.0 (PHP 8.0 is EOL as of 11-26-2023) is the same error that &lt;a href="https://community.developer.cybersource.com/t5/user/viewprofilepage/user-id/64575"&gt;@iteracy&lt;/a&gt; received:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Deprecated [description] =&amp;gt; Return type of net\authorize\api\contract\v1\MerchantAuthenticationType::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice [file]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The workaround was to fork the &lt;A title="https://github.com/AuthorizeNet/sdk-php" href="https://github.com/AuthorizeNet/sdk-php" target="_blank" rel="noopener"&gt;https://github.com/AuthorizeNet/sdk-php&lt;/A&gt; and do a search and replace for all references of&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;public function jsonSerialize(){&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;then replace this with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;   #[\ReturnTypeWillChange]
    public function jsonSerialize(): mixed
    {&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P data-unlink="true"&gt;Based on the error message I received, specifying the return type to mixed and/or adding &lt;SPAN&gt;#[\ReturnTypeWillChange] &lt;/SPAN&gt;will &lt;SPAN&gt;temporarily suppress the notice. I tested the fork with our PHPUnit test suite and the errors went away and the warning message went away. You can use our version of the AuthorizeNet/sdk-php -&amp;gt; &lt;A title="https://github.com/resumeblaze/sdk-php" href="https://github.com/resumeblaze/sdk-php" target="_blank" rel="noopener"&gt;https://github.com/resumeblaze/sdk-php&lt;/A&gt;.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;You can see there were 528 additions and 178 deletions: &lt;A title="https://github.com/AuthorizeNet/sdk-php/compare/master...resumeblaze:sdk-php:master" href="https://github.com/AuthorizeNet/sdk-php/compare/master...resumeblaze:sdk-php:master" target="_blank" rel="noopener"&gt;https://github.com/AuthorizeNet/sdk-php/compare/master...resumeblaze:sdk-php:master&lt;/A&gt;. Then number of changes is inline with other users that have come across the same issue, for example&lt;A title="https://github.com/AuthorizeNet/sdk-php/compare/master...zhartaunik:authorizenet-sdk-php:master" href="https://github.com/AuthorizeNet/sdk-php/compare/master...zhartaunik:authorizenet-sdk-php:master" target="_blank" rel="noopener"&gt;https://github.com/AuthorizeNet/sdk-php/compare/master...zhartaunik:authorizenet-sdk-php:master&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;Its important to note this does not fix the problem, it will suppress the notice so that you may use the package with PHP 8.1.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 09:15:42 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Upgrading-PHP-SDK-to-PHP-8-1/m-p/88512#M55773</guid>
      <dc:creator>dblaze</dc:creator>
      <dc:date>2024-01-04T09:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrading PHP SDK to PHP 8.1</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Upgrading-PHP-SDK-to-PHP-8-1/m-p/88534#M55788</link>
      <description>&lt;P&gt;I can't believe they still haven't fixed this &lt;LI-EMOJI id="lia_face-with-open-mouth" title=":face_with_open_mouth:"&gt;&lt;/LI-EMOJI&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jan 2024 08:27:31 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Upgrading-PHP-SDK-to-PHP-8-1/m-p/88534#M55788</guid>
      <dc:creator>iteracy</dc:creator>
      <dc:date>2024-01-05T08:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrading PHP SDK to PHP 8.1</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Upgrading-PHP-SDK-to-PHP-8-1/m-p/88558#M55802</link>
      <description>&lt;P&gt;Here is an update from support. Looks like support can't help with this issue and the case was automatically closed.&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;EM&gt;Thank you for contacting Authorize.Net in regard to integration, happy to assist.&lt;/EM&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;EM&gt;I understand that you need assistance on the compatibility of PHP versions. &lt;STRONG&gt;We apologize, but we are not trained in web development or integration, so our ability to answer developer or integration related questions is limited. We can only assist for some basic troubleshooting steps about integration.&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;EM&gt;We appreciate your time and business.&lt;/EM&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;EM&gt;If the information provided above satisfies your needs, please close this Support Case. Otherwise, please add an update to this Support Case with your follow-up questions so I can further assist you. For your convenience the Authorize.Net Support Center, located at: &lt;A href="https://support.authorize.net" target="_blank"&gt;https://support.authorize.net&lt;/A&gt;. You may also call us at (877) 447-3938, available 24 hours a day, 7 days a week.&lt;/EM&gt;&lt;/P&gt;&lt;P class="lia-indent-padding-left-30px"&gt;&lt;EM&gt;For more information regarding our privacy practices, visit the privacy page at Authorize.Net.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jan 2024 18:42:26 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Upgrading-PHP-SDK-to-PHP-8-1/m-p/88558#M55802</guid>
      <dc:creator>dblaze</dc:creator>
      <dc:date>2024-01-08T18:42:26Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrading PHP SDK to PHP 8.1</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Upgrading-PHP-SDK-to-PHP-8-1/m-p/88570#M55810</link>
      <description>&lt;P&gt;One more update! I spoke to someone at Authorize.net today and they are aware of the issue. They have been contacted by several merchants encountering the same error. Keep the pressure on the support team and open tickets at &lt;A href="https://support.authorize.net/" target="_blank"&gt;https://support.authorize.net/&lt;/A&gt;. They said they will update the SDK soon. Make sure to point out that PHP 8.1 is the current (stable version of PHP). 8.0 is no longer supported: &lt;A href="https://www.php.net/supported-versions.php" target="_self"&gt;https://www.php.net/supported-versions.php&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jan 2024 23:17:33 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Upgrading-PHP-SDK-to-PHP-8-1/m-p/88570#M55810</guid>
      <dc:creator>dblaze</dc:creator>
      <dc:date>2024-01-09T23:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: Upgrading PHP SDK to PHP 8.1</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Upgrading-PHP-SDK-to-PHP-8-1/m-p/88588#M55825</link>
      <description>&lt;P&gt;It appears that when you upgrade to PHP 8.2, there is another subtle error. The latest release of PHP is 8.2, not 8.1. There are only security updates for PHP 8.1 for the next 10-months. 8.2 is in active development for the next 10-months. See&lt;BR /&gt;&lt;A href="https://www.php.net/supported-versions.php" target="_blank" rel="noopener"&gt;https://www.php.net/supported-versions.php&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;/authorizenet/lib/net/authorize/util/Log.php:366
Creation of dynamic property net\authorize\util\Log::$sensitiveStringRegexes is deprecated&lt;/LI-CODE&gt;&lt;P&gt;This is a simple fix, go to:&lt;BR /&gt;sdk-php/lib/net/authorize/util/Log.php on line 34 and add a declaration.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;private $sensitiveStringRegexes = NULL;&lt;/LI-CODE&gt;&lt;P&gt;The warning will go away. I have made this change to the forked repository at &lt;A href="https://github.com/resumeblaze/sdk-php/releases/tag/2.0.4" target="_blank" rel="noopener"&gt;https://github.com/resumeblaze/sdk-php/releases/tag/2.0.4&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I bumped our forked version from 2.0.3 to 2.0.4&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jan 2024 08:50:14 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Upgrading-PHP-SDK-to-PHP-8-1/m-p/88588#M55825</guid>
      <dc:creator>dblaze</dc:creator>
      <dc:date>2024-01-11T08:50:14Z</dc:date>
    </item>
  </channel>
</rss>

