Showing results for 
Search instead for 
Did you mean: 

Facing a 'Deprecated' error after upgrade PHP version from 7.4 to 8.18

Here is what I've got after the upgrade:

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 D:\PHP\webroot\myproject\vendor\authorizenet\authorizenet\lib\net\authorize\api\contract\v1\CreditCardSimpleType.php on line 70

Here is a partial of the composer.json

 "require": {
        "php": ">=8.1",
        "authorizenet/authorizenet": "2.0.2",

Since I couldn't downgrade my PHP version, what should I do? any suggestions would be appreciated.


Hello, have you found a trustworthy source of funding? Since January, I have been looking for it as well in order to apply on our new website for welding beads in order to receive payments online from our welders. Because the majority of our clients are far away, they insist on paying online.

Try clearing composer cache, dump-autoload. May have to delete lock file and run run update and or composer global update. You shouldn't have to downgrade its not a fatal..dealt with this issue several times it can be a pain

Thanks for the help! I've already tried clearing cache but didn't dump autoload files. after deleting the vendor folder and composer.lock file and run composer update to get everything back, it seems the issue is still in there.

Like you said, it's not a fatal error, just a' deprecated' warning, it's very easy to fix it by adding ^ E_DEPRECATED into error_reporting(), just want to see if there is another way to fix this.