cancel
Showing results for 
Search instead for 
Did you mean: 

Upgrade PHP SDK to Support PHP 8.3

The current official version of the PHP SDK is v2.0.2. There are well documented issues that can be reviewed in an older thread started by iteracy: Upgrading PHP SDK to PHP 8.1. I had forked the PHP SDK to address the warning and deprecation notices for both PHP8.1 and PHP8.2. That can be found at https://github.com/resumeblaze/sdk-php. Use version 2.0.3 for PHP8.1 and 2.0.4 for PHP8.2 comparability.


Using the forked version 2.0.4 will still have deprecation notices for PHP8.3. PHP8.3, which was released on 23 Nov 2023, has several deprecation notices that are related to

 

Calling get_class() without arguments is deprecated​


Here is the full list of the deprecation notices:

 

 

1) /authorizenet/lib/net/authorize/api/contract/v1/GetCustomerPaymentProfileRequest.php:130
Calling get_class() without arguments is deprecated

2) /authorizenet/lib/net/authorize/api/contract/v1/ANetApiRequestType.php:108
Calling get_class() without arguments is deprecated

3) /authorizenet/lib/net/authorize/api/contract/v1/MerchantAuthenticationType.php:270
Calling get_class() without arguments is deprecated

4) /authorizenet/lib/net/authorize/api/contract/v1/GetCustomerPaymentProfileResponse.php:47
Calling get_class() without arguments is deprecated

5) /authorizenet/lib/net/authorize/api/contract/v1/MessagesType.php:141
Calling get_class() without arguments is deprecated

6) /authorizenet/lib/net/authorize/api/contract/v1/MessagesType/MessageAType.php:104
Calling get_class() without arguments is deprecated

7) /authorizenet/lib/net/authorize/api/contract/v1/CreateCustomerProfileRequest.php:76
Calling get_class() without arguments is deprecated

8) /authorizenet/lib/net/authorize/api/contract/v1/CustomerProfileType.php:177
Calling get_class() without arguments is deprecated

9) /authorizenet/lib/net/authorize/api/contract/v1/CustomerProfileBaseType.php:106
Calling get_class() without arguments is deprecated

10) /authorizenet/lib/net/authorize/api/contract/v1/CustomerPaymentProfileType.php:162
Calling get_class() without arguments is deprecated

11) /authorizenet/lib/net/authorize/api/contract/v1/CustomerPaymentProfileBaseType.php:79
Calling get_class() without arguments is deprecated

12) /authorizenet/lib/net/authorize/api/contract/v1/CustomerAddressType.php:106
Calling get_class() without arguments is deprecated

13) /authorizenet/lib/net/authorize/api/contract/v1/NameAndAddressType.php:241
Calling get_class() without arguments is deprecated

14) /authorizenet/lib/net/authorize/api/contract/v1/PaymentType.php:242
Calling get_class() without arguments is deprecated

15) /authorizenet/lib/net/authorize/api/contract/v1/CreditCardType.php:187
Calling get_class() without arguments is deprecated

16) /authorizenet/lib/net/authorize/api/contract/v1/CreditCardSimpleType.php:79
Calling get_class() without arguments is deprecated

17) /authorizenet/lib/net/authorize/api/contract/v1/CreateCustomerProfileResponse.php:228
Calling get_class() without arguments is deprecated

18) /authorizenet/lib/net/authorize/api/contract/v1/GetCustomerProfileRequest.php:157
Calling get_class() without arguments is deprecated

19) /authorizenet/lib/net/authorize/api/contract/v1/GetCustomerProfileResponse.php:106
Calling get_class() without arguments is deprecated

20) /authorizenet/lib/net/authorize/api/contract/v1/CustomerProfileMaskedType.php:205
Calling get_class() without arguments is deprecated

21) /authorizenet/lib/net/authorize/api/contract/v1/CustomerPaymentProfileMaskedType.php:331
Calling get_class() without arguments is deprecated

22) /authorizenet/lib/net/authorize/api/contract/v1/PaymentMaskedType.php:134
Calling get_class() without arguments is deprecated

23) /authorizenet/lib/net/authorize/api/contract/v1/CreditCardMaskedType.php:215
Calling get_class() without arguments is deprecated

24) /authorizenet/lib/net/authorize/api/contract/v1/CustomerAddressType.php:134
Calling get_class() without arguments is deprecated

25) /authorizenet/lib/net/authorize/api/contract/v1/DeleteCustomerProfileRequest.php:49
Calling get_class() without arguments is deprecated

26) /authorizenet/lib/net/authorize/api/contract/v1/DeleteCustomerProfileResponse.php:18
Calling get_class() without arguments is deprecated

27) /authorizenet/lib/net/authorize/api/contract/v1/GetTransactionDetailsRequest.php:49
Calling get_class() without arguments is deprecated

28) /authorizenet/lib/net/authorize/api/contract/v1/GetTransactionDetailsResponse.php:99
Calling get_class() without arguments is deprecated

29) /authorizenet/lib/net/authorize/api/contract/v1/TransactionDetailsType.php:1600
Calling get_class() without arguments is deprecated

30) /authorizenet/lib/net/authorize/api/contract/v1/OrderExType.php:80
Calling get_class() without arguments is deprecated

31) /authorizenet/lib/net/authorize/api/contract/v1/CustomerDataType.php:188
Calling get_class() without arguments is deprecated

32) /authorizenet/lib/net/authorize/api/contract/v1/UpdateCustomerProfileRequest.php:49
Calling get_class() without arguments is deprecated

33) /authorizenet/lib/net/authorize/api/contract/v1/CustomerProfileExType.php:52
Calling get_class() without arguments is deprecated

34) /authorizenet/lib/net/authorize/api/contract/v1/UpdateCustomerProfileResponse.php:18
Calling get_class() without arguments is deprecated

35) /authorizenet/lib/net/authorize/api/contract/v1/UpdateCustomerPaymentProfileRequest.php:105
Calling get_class() without arguments is deprecated

36) /authorizenet/lib/net/authorize/api/contract/v1/CustomerPaymentProfileExType.php:52
Calling get_class() without arguments is deprecated

37) /authorizenet/lib/net/authorize/api/contract/v1/UpdateCustomerPaymentProfileResponse.php:45
Calling get_class() without arguments is deprecated

38) /authorizenet/lib/net/authorize/api/contract/v1/CustomerProfileIdType.php:134
Calling get_class() without arguments is deprecated

39) /authorizenet/lib/net/authorize/api/contract/v1/DeleteCustomerPaymentProfileRequest.php:76
Calling get_class() without arguments is deprecated

40) /authorizenet/lib/net/authorize/api/contract/v1/DeleteCustomerPaymentProfileResponse.php:18
Calling get_class() without arguments is deprecated

41) /authorizenet/lib/net/authorize/api/contract/v1/CreateCustomerPaymentProfileRequest.php:104
Calling get_class() without arguments is deprecated

42) /authorizenet/lib/net/authorize/api/contract/v1/CreateCustomerPaymentProfileResponse.php:99
Calling get_class() without arguments is deprecated

43) /authorizenet/lib/net/authorize/api/contract/v1/FDSFilterType.php:107
Calling get_class() without arguments is deprecated

44) /authorizenet/lib/net/authorize/api/contract/v1/ValidateCustomerPaymentProfileRequest.php:157
Calling get_class() without arguments is deprecated

45) /authorizenet/lib/net/authorize/api/contract/v1/ValidateCustomerPaymentProfileResponse.php:45
Calling get_class() without arguments is deprecated

46) /authorizenet/lib/net/authorize/api/contract/v1/GetCustomerProfileIdsResponse.php:79
Calling get_class() without arguments is deprecated

47) /authorizenet/lib/net/authorize/api/contract/v1/CreateTransactionRequest.php:50
Calling get_class() without arguments is deprecated

48) /authorizenet/lib/net/authorize/api/contract/v1/TransactionRequestType.php:1130
Calling get_class() without arguments is deprecated

49) /authorizenet/lib/net/authorize/api/contract/v1/CustomerProfilePaymentType.php:133
Calling get_class() without arguments is deprecated

50) /authorizenet/lib/net/authorize/api/contract/v1/PaymentProfileType.php:79
Calling get_class() without arguments is deprecated

51) /authorizenet/lib/net/authorize/api/contract/v1/CreateTransactionResponse.php:75
Calling get_class() without arguments is deprecated

52) /authorizenet/lib/net/authorize/api/contract/v1/TransactionResponseType.php:896
Calling get_class() without arguments is deprecated

53) /authorizenet/lib/net/authorize/api/contract/v1/TransactionResponseType/PrePaidCardAType.php:131
Calling get_class() without arguments is deprecated

54) /authorizenet/lib/net/authorize/api/contract/v1/TransactionResponseType/ErrorsAType/ErrorAType.php:104
Calling get_class() without arguments is deprecated

55) /authorizenet/lib/net/authorize/api/contract/v1/TransactionResponseType/MessagesAType/MessageAType.php:104
Calling get_class() without arguments is deprecated
​

 

I will try to resolve these deprecation notices in another fork. Hopefully someone from Authorize.net will put the official fixes in their SDK as the latest version is from March 31, 2021. That version only supports PHP8.0.

 

dblaze
Contributor
3 REPLIES 3

To fix the deprecation notices you need to find all the instances where get_class() is called and replace that call with get_class($this).

#Find this declaration and any where get_class() is called
$classDetails = $mapper->getClass(get_class() , $key);

#Replace this declaration with get_class($this)
$classDetails = $mapper->getClass(get_class($this) , $key);

You can use our v2.0.5 that contains these changes https://github.com/resumeblaze/sdk-php/releases/tag/v2.0.5

I followed a PHP Watch article and how to resolve the get_class() deprecation warning. I hope this helps.

dblaze
Contributor

Will auithorize.net be releasing an official version that fixes this depreciated warning?

I have no idea. They are certainly in no hurry to upgrade the SDK, there have been complaints since March 16, 2023.

https://github.com/AuthorizeNet/sdk-php/issues/440