CyberSource / CyberSource/cybersource-rest-client-php

Fixable compatibility issues with PHP 8.2-8.3

Open
#153 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
41
Forks
77
Avg merge
26m
Merged PRs (30d)
1

Description

Hi,

I'm using v0.0.47 of the SDK but the following seems to be an issue also on the latest version. Some classes seem to assign properties dynamically without declaring them. This has been deprecated in PHP 8.2 (resulting in thrown deprecation notices) and will result in fatal errors in future versions.

https://www.php.net/manual/en/language.oop5.properties.php#language.oop5.properties.dynamic-properties

Here's a partial list of notices I've seen:

  • vendor/cybersource/rest-client-php/lib/Authentication/Core/MerchantConfiguration.php on line 228
  • vendor/cybersource/rest-client-php/lib/ApiClient.php on line 108
  • vendor/cybersource/rest-client-php/lib/ApiClient.php on line 240
  • vendor/cybersource/rest-client-php/lib/Authentication/PayloadDigest/PayloadDigest.php on line 47
  • vendor/cybersource/rest-client-php/lib/Authentication/Http/HttpSignatureGenerator.php on line 78
  • vendor/cybersource/rest-client-php/lib/Authentication/PayloadDigest/PayloadDigest.php on line 47

there might be more

A quick workaround for this could be to add a #[AllowDynamicProperties] attribute at the start of the affected classes until a more robust handling is in place.

https://www.php.net/manual/en/class.allowdynamicproperties.php

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the listed classes in lib/Authentication/Core/MerchantConfiguration.php, lib/ApiClient.php, lib/Authentication/PayloadDigest/PayloadDigest.php, and lib/Authentication/Http/HttpSignatureGenerator.php, then check for additional affected classes. Reproduce the compatibility notices on PHP 8.2-8.3 and determine whether the affected properties are declared or require the proposed compatibility handling. Done means the SDK no longer emits these dynamic-property deprecation notices.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.