sdk-php icon indicating copy to clipboard operation
sdk-php copied to clipboard

Deprecated: 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 in /var/www/html/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/MerchantAuthenticationType.php on line 261

Open pthreat opened this issue 2 years ago • 25 comments

Deprecated: 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 in /var/www/html/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/MerchantAuthenticationType.php on line 261

For PHP 8.1

pthreat avatar Sep 13 '22 19:09 pthreat

Bumping, as we are getting the same issue, and it's making implementation with 8.1 difficult.

efitz16 avatar Oct 24 '22 16:10 efitz16

Same deprecation warning here:

( ! ) Deprecated: Return type of net\authorize\api\contract\v1\CreditCardSimpleType::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in public_html\vendor\authorizenet\authorizenet\lib\net\authorize\api\contract\v1\CreditCardSimpleType.php on line 70

For PHP 8.1

XIAOXIAOSIYU avatar Nov 07 '22 02:11 XIAOXIAOSIYU

Same error for me when running on PHP 8.1:

Error: 500 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

This is a pretty critical issue, not supporting the latest PHP version. End of support for PHP 7.4 is only weeks away, and going back to 8.0 isn't ideal.

csears123 avatar Nov 07 '22 22:11 csears123

https://github.com/AuthorizeNet/sdk-php/pull/439

zhartaunik avatar Nov 15 '22 09:11 zhartaunik

@zhartaunik, I ended up forking this repo and adding the return type 'mixed' to all the jsonSerialize() class methods.

The AuthorizeNet contributing guidelines below will not accept PRs for changes to the auto-generated request and response classes: https://github.com/AuthorizeNet/sdk-php/blob/a3e76f96f674d16e892f87c58bedb99dada4b067/CONTRIBUTING.md

"Part of the SDK is auto-generated based on the XML schema. Due to this auto-generation, we cannot merge contributions for request or response classes. You are welcome to open an issue to report problems or suggest improvements. Auto-generated classes include all files inside contract/v1 and controller folders, except controller/base."

Hoping the AuthorizeNet sdk owners will make these simple changes to support PHP 8.1.

csears123 avatar Nov 15 '22 14:11 csears123

@csears123 thanks for your response. Looks like I have to use my own fork for the client...

zhartaunik avatar Nov 15 '22 14:11 zhartaunik

Same issue today.

eneerge avatar Feb 13 '23 22:02 eneerge

Hi Facing the same issue in Magento2.2.5p2(cloud) with PHP version 8.1 . Anyone got the solution of it ? I we add the #[\ReturnTypeWillChange] in core file function where its break , its behaves normally , But i don't want to change the core file . I tried to override the same file in custom module but code breaks on compile then . Anyone have the solution to make it work ?

Usmanbashir123 avatar Mar 14 '23 09:03 Usmanbashir123

Still waiting for the devs to make this simple adjustment or to accept the pull request. Looks like I'll need to use forked versions.

dustincochran avatar May 10 '23 19:05 dustincochran

Hi ,

This issue has been fixed in the recent release of 2.0.4 .

On Thu, May 11, 2023 at 12:49 AM Dustin Cochran @.***> wrote:

Still waiting for the devs to make this simple adjustment or to accept the pull request. Looks like I'll need to use forked versions.

— Reply to this email directly, view it on GitHub https://github.com/AuthorizeNet/sdk-php/issues/437#issuecomment-1542720251, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZ3C7LAKY3LDFUHOW2RZYLDXFPWN5ANCNFSM6AAAAAAQLX6YRU . You are receiving this because you commented.Message ID: @.***>

-- Thank you. Regards, *Usman Bashir **Software Engineer * P (UK): +44-207-993-8524 <+44%2020%207993%208524> P (PK): +92-42-36407166 P (US): +1-310-492-5564 <(310)%20492-5564> URL: www.rolustech.com

Usmanbashir123 avatar May 11 '23 06:05 Usmanbashir123

That is great news, however, I do not see a 2.0.4 release, nor does composer.

On Thu, May 11, 2023 at 2:01 AM Usmanbashir123 @.***> wrote:

Hi ,

This issue has been fixed in the recent release of 2.0.4 .

On Thu, May 11, 2023 at 12:49 AM Dustin Cochran @.***> wrote:

Still waiting for the devs to make this simple adjustment or to accept the pull request. Looks like I'll need to use forked versions.

— Reply to this email directly, view it on GitHub < https://github.com/AuthorizeNet/sdk-php/issues/437#issuecomment-1542720251 , or unsubscribe < https://github.com/notifications/unsubscribe-auth/AZ3C7LAKY3LDFUHOW2RZYLDXFPWN5ANCNFSM6AAAAAAQLX6YRU

. You are receiving this because you commented.Message ID: @.***>

-- Thank you. Regards, *Usman Bashir **Software Engineer * P (UK): +44-207-993-8524 <+44%2020%207993%208524> P (PK): +92-42-36407166 P (US): +1-310-492-5564 <(310)%20492-5564> URL: www.rolustech.com

— Reply to this email directly, view it on GitHub https://github.com/AuthorizeNet/sdk-php/issues/437#issuecomment-1543386053, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQDTA3A7EZIESRQDG26P6TXFR6DBANCNFSM6AAAAAAQLX6YRU . You are receiving this because you commented.Message ID: @.***>

-- ~ Dustin

dustincochran avatar May 11 '23 13:05 dustincochran

The packagist.org website has been updated to version 2.0.4 and the link to access it is https://packagist.org/packages/powersync/authorizenet-sdk-php.

Usmanbashir123 avatar May 11 '23 13:05 Usmanbashir123

The packagist.org website has been updated to version 2.0.4 and the link to access it is https://packagist.org/packages/powersync/authorizenet-sdk-php.

Is this an official package from the Authorize.Net team?

XIAOXIAOSIYU avatar Jun 20 '23 18:06 XIAOXIAOSIYU

No, it is not

On Tue, Jun 20, 2023, 2:09 PM Jack Zhao @.***> wrote:

The packagist.org website has been updated to version 2.0.4 and the link to access it is https://packagist.org/packages/powersync/authorizenet-sdk-php.

Is this an official package from the Authorize.Net team?

— Reply to this email directly, view it on GitHub https://github.com/AuthorizeNet/sdk-php/issues/437#issuecomment-1599273895, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQDTA5QLCJ2MZ4AX4IQYFLXMHROJANCNFSM6AAAAAAQLX6YRU . You are receiving this because you commented.Message ID: @.***>

dustincochran avatar Jun 21 '23 11:06 dustincochran

There are at least four locations in the codebase where this deprecated issue exists:

Deprecated: 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 in /var/www/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/MerchantAuthenticationType.php on line 261


Deprecated: Return type of net\authorize\api\contract\v1\CreditCardSimpleType::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/CreditCardSimpleType.php on line 70


Deprecated: Return type of net\authorize\api\contract\v1\PaymentType::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/PaymentType.php on line 233


Deprecated: Return type of net\authorize\api\contract\v1\OrderType::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /var/www/vendor/authorizenet/authorizenet/lib/net/authorize/api/contract/v1/OrderType.php on line 502


Why haven't the Authorize.net developers updated / refactored this SDK to work with PHP8.1+? In over ONE YEAR?

I do not want to use a non-official version (using composer).

davidfeldt avatar Dec 17 '23 22:12 davidfeldt

Hey David,

Yes, they don't seem to be developing the PHP SDK anymore. I spoke with them on the phone a long time ago and they told me that they were eliminating some of the SDKs, they didn't tell me which ones back then, but I think it is safe to assume the PHP one has been removed from development. The same thing happened with Paypal.

What I used was the forked version by "zhartaunik/authorizenet". ( https://github.com/zhartaunik/authorizenet-sdk-php)

You can review his commits like I did and see he basically just updated the composer file and replaced all the function helpers to return "mixed".

I have been using his version 3.0.0 ever since. Just do not update to any future version without reviewing the code!

On Sun, Dec 17, 2023 at 5:30 PM David Feldt @.***> wrote:

There are at least four places where this deprecated issue occurs. Why haven't the Authorize.net developers updated / refactored this SDK to work with PHP8.1+? In over ONE YEAR?

I do not want to use a non-official version (using composer).

— Reply to this email directly, view it on GitHub https://github.com/AuthorizeNet/sdk-php/issues/437#issuecomment-1859305472, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQDTA2Z3XMWA3BXKFKYOSLYJ5W6TAVCNFSM6AAAAAAQLX6YRWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZGMYDKNBXGI . You are receiving this because you commented.Message ID: @.***>

-- ~ Dustin

dustincochran avatar Dec 18 '23 14:12 dustincochran

Thanks for letting me know - appreciate it.


From: Dustin Cochran @.> Sent: Monday, December 18, 2023 9:06 AM To: AuthorizeNet/sdk-php @.> Cc: David Feldt @.>; Comment @.> Subject: Re: [AuthorizeNet/sdk-php] Deprecated: Return type of net\authorize\api\contract\v1\MerchantAuthenticationType::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should ...

Hey David,

Yes, they don't seem to be developing the PHP SDK anymore. I spoke with them on the phone a long time ago and they told me that they were eliminating some of the SDKs, they didn't tell me which ones back then, but I think it is safe to assume the PHP one has been removed from development. The same thing happened with Paypal.

What I used was the forked version by "zhartaunik/authorizenet". ( https://github.com/zhartaunik/authorizenet-sdk-php)

You can review his commits like I did and see he basically just updated the composer file and replaced all the function helpers to return "mixed".

I have been using his version 3.0.0 ever since. Just do not update to any future version without reviewing the code!

On Sun, Dec 17, 2023 at 5:30 PM David Feldt @.***> wrote:

There are at least four places where this deprecated issue occurs. Why haven't the Authorize.net developers updated / refactored this SDK to work with PHP8.1+? In over ONE YEAR?

I do not want to use a non-official version (using composer).

— Reply to this email directly, view it on GitHub https://github.com/AuthorizeNet/sdk-php/issues/437#issuecomment-1859305472, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQDTA2Z3XMWA3BXKFKYOSLYJ5W6TAVCNFSM6AAAAAAQLX6YRWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJZGMYDKNBXGI . You are receiving this because you commented.Message ID: @.***>

-- ~ Dustin

— Reply to this email directly, view it on GitHubhttps://github.com/AuthorizeNet/sdk-php/issues/437#issuecomment-1860592499, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAESF4NVYZYK25VL5GOIUADYKBEUZAVCNFSM6AAAAAAQLX6YRWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRQGU4TENBZHE. You are receiving this because you commented.Message ID: @.***>

davidfeldt avatar Dec 18 '23 14:12 davidfeldt

Is there a manual fix for this issue? I need to get this code up and running.

LEO-Network avatar Dec 29 '23 02:12 LEO-Network

Yes, you can manually change all 174 files like "zhartaunik" did. Or, you can just do what I did and use his version " https://github.com/zhartaunik/authorizenet-sdk-php" and don't update unless you review the changes.

You can review the changes here: https://github.com/AuthorizeNet/sdk-php/compare/master...zhartaunik:authorizenet-sdk-php:master

You will see 99% of the changes are just adding a function return type helper to the jsonSerialize function of "mixed".

On Thu, Dec 28, 2023 at 9:27 PM LEO-Network @.***> wrote:

Is there a manual fix for this issue? I need to get this code up and running.

— Reply to this email directly, view it on GitHub https://github.com/AuthorizeNet/sdk-php/issues/437#issuecomment-1871682861, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQDTA227MKUBGSBELJRIU3YLYTBHAVCNFSM6AAAAAAQLX6YRWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRGY4DEOBWGE . You are receiving this because you commented.Message ID: @.***>

-- ~ Dustin

dustincochran avatar Dec 29 '23 14:12 dustincochran

Yes, you can manually change all 174 files like "zhartaunik" did. Or, you can just do what I did and use his version " https://github.com/zhartaunik/authorizenet-sdk-php" and don't update unless you review the changes. You can review the changes here: master...zhartaunik:authorizenet-sdk-php:master You will see 99% of the changes are just adding a function return type helper to the jsonSerialize function of "mixed". On Thu, Dec 28, 2023 at 9:27 PM LEO-Network @.> wrote: Is there a manual fix for this issue? I need to get this code up and running. — Reply to this email directly, view it on GitHub <#437 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQDTA227MKUBGSBELJRIU3YLYTBHAVCNFSM6AAAAAAQLX6YRWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRGY4DEOBWGE . You are receiving this because you commented.Message ID: @.> -- ~ Dustin

I'm still getting this error with php 8.0.

Deprecated: Creation of dynamic property net\authorize\util\Log::$sensitiveStringRegexes is deprecated in /home/mzkxqimy/public_html/sdk/lib/net/authorize/util/Log.php on line 366

LEO-Network avatar Jan 01 '24 09:01 LEO-Network

I'm at a loss here. I tried what you said, still didn't work. I found that people were saying 2.02 worked. I tried that, still doesn't work. 2.02 brings back to the json serialize errors as well as the $senstiiveStringRegexes error

LEO-Network avatar Jan 01 '24 18:01 LEO-Network

Just with a quick look at the file, you could probably just declare the "sensitiveStringRegexes" variable at the top of the "Log" class.

Around line 31, I would just add "private $sensitiveStringRegexes = NULL;" right under "private $sensitiveXmlTags = NULL;"

On Mon, Jan 1, 2024 at 4:12 AM Matt B @.***> wrote:

Yes, you can manually change all 174 files like "zhartaunik" did. Or, you can just do what I did and use his version " https://github.com/zhartaunik/authorizenet-sdk-php" and don't update unless you review the changes. You can review the changes here: master...zhartaunik:authorizenet-sdk-php:master https://github.com/AuthorizeNet/sdk-php/compare/master...zhartaunik:authorizenet-sdk-php:master You will see 99% of the changes are just adding a function return type helper to the jsonSerialize function of "mixed". … <#m_-8667912795260077780_> On Thu, Dec 28, 2023 at 9:27 PM LEO-Network @.> wrote: Is there a manual fix for this issue? I need to get this code up and running. — Reply to this email directly, view it on GitHub <#437 (comment) https://github.com/AuthorizeNet/sdk-php/issues/437#issuecomment-1871682861>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQDTA227MKUBGSBELJRIU3YLYTBHAVCNFSM6AAAAAAQLX6YRWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRGY4DEOBWGE https://github.com/notifications/unsubscribe-auth/AAQDTA227MKUBGSBELJRIU3YLYTBHAVCNFSM6AAAAAAQLX6YRWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRGY4DEOBWGE . You are receiving this because you commented.Message ID: @.> -- ~ Dustin

I'm still getting this error with php 8.0.

Deprecated: Creation of dynamic property net\authorize\util\Log::$sensitiveStringRegexes is deprecated in /home/mzkxqimy/public_html/sdk/lib/net/authorize/util/Log.php on line 366

— Reply to this email directly, view it on GitHub https://github.com/AuthorizeNet/sdk-php/issues/437#issuecomment-1873238517, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQDTAYJXXN7CMS77BGHHO3YMJ4YLAVCNFSM6AAAAAAQLX6YRWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZTGIZTQNJRG4 . You are receiving this because you commented.Message ID: @.***>

-- ~ Dustin

dustincochran avatar Jan 02 '24 13:01 dustincochran

Yes, you can manually change all 174 files like "zhartaunik" did. Or, you can just do what I did and use his version " https://github.com/zhartaunik/authorizenet-sdk-php" and don't update unless you review the changes. You can review the changes here: master...zhartaunik:authorizenet-sdk-php:master You will see 99% of the changes are just adding a function return type helper to the jsonSerialize function of "mixed". On Thu, Dec 28, 2023 at 9:27 PM LEO-Network @.> wrote: Is there a manual fix for this issue? I need to get this code up and running. — Reply to this email directly, view it on GitHub <#437 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQDTA227MKUBGSBELJRIU3YLYTBHAVCNFSM6AAAAAAQLX6YRWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZRGY4DEOBWGE . You are receiving this because you commented.Message ID: @.> -- ~ Dustin

I can confirm this worked for me. I was able to fork the official repository https://github.com/AuthorizeNet/sdk-php and suppress the error notices like @zhartaunik did. https://github.com/resumeblaze/sdk-php.

I also put in a ticket with Authorize.net support. I suggest that everyone does the same at https://support.authorize.net/. Hopefully more squeaky wheels will get an updated version. They did update the SDK to accommodate PHP 8.0 in 2021.

resumeblaze avatar Jan 04 '24 09:01 resumeblaze

Per support: "It looks like there are currently no plans to update SDK-PHP."

Hopefully more folks bubble up support cases on this; that's a massive segment of customers to lose if they abandon those using PHP based CMS systems.

@resumeblaze appreciate you championing a fork to support us running 8.2 and greater! Cheers!

JackStromberg avatar Jan 17 '24 16:01 JackStromberg

@JackStromberg, thank you for the update. That is funny, the support team told me something different. Based on your interaction with Authorize.net support, I published the forked repo I am using in production to packagist.org. I tested the repo on resumeblaze.com and there hasn't been any issues. We have been successfully processing credit cards using PHP8.3.

You can now use composer to install the releases that best suite your needs. The package can be found at https://packagist.org/packages/resumeblaze/authorizenet.

Version 2.0.3 - PHP8.1 Support Version 2.0.4 - PHP8.2 Support Version 2.0.5 - PHP8.3 Support

resumeblaze avatar Jan 17 '24 18:01 resumeblaze