Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creation of dynamic property deprecation warnings on PHP 8.2 #155

Open
hjheath opened this issue Feb 15, 2023 · 8 comments
Open

Creation of dynamic property deprecation warnings on PHP 8.2 #155

hjheath opened this issue Feb 15, 2023 · 8 comments

Comments

@hjheath
Copy link
Contributor

hjheath commented Feb 15, 2023

This library seems to be hitting this deprecation warning: https://php.watch/versions/8.2/dynamic-properties-deprecated

Steps to repro:

  • Install the library on PHP 8.2
  • Initialize the client

Results:

PHP Deprecated:  Creation of dynamic property GoCardlessPro\Core\ApiClient::$http_client is deprecated in /Users/hheath/code/php_sandbox/vendor/gocardless/gocardless-pro/lib/Core/ApiClient.php on line 24

Deprecated: Creation of dynamic property GoCardlessPro\Core\ApiClient::$http_client is deprecated in /Users/hheath/code/php_sandbox/vendor/gocardless/gocardless-pro/lib/Core/ApiClient.php on line 24
PHP Deprecated:  Creation of dynamic property GoCardlessPro\Core\ApiClient::$error_on_idempotency_conflict is deprecated in /Users/hheath/code/php_sandbox/vendor/gocardless/gocardless-pro/lib/Core/ApiClient.php on line 25

Deprecated: Creation of dynamic property GoCardlessPro\Core\ApiClient::$error_on_idempotency_conflict is deprecated in /Users/hheath/code/php_sandbox/vendor/gocardless/gocardless-pro/lib/Core/ApiClient.php on line 25
@Nimisoere
Copy link
Contributor

Thanks Henry,

We're looking to update the PHP library to support v8+. We'll update this ticket once this is done

@davidearl
Copy link

I also see deprecation warnings for PHP8.2 which I am running in a development version specifically in order to catch these in my code prior to Debian Bookwork release which is now only a couple of months away which will come with PHP8.2 as standard. (8.2 is already a quarter of the way through as current version of PHP, and all version 7s are now well past their end-of-life dates).

In particular, the assignment to customer_bank_accounts in Client.php in method customerBankAccounts raises a deprecation notice..

The biggest change in my code, and probably will be in yours too, is the requirement for all class properties on non-anonymous classes to be explicitly declared (or an exception marked for the whole class). Though they are "only" warnings at this stage, I catch all PHP notices and send myself an alert, so it is a nuisance to keep getting notifications about third-party code that I can't do much about.

Anyway, just putting this here so I hear from GitHub when you update this ticket.

@dpslwk
Copy link

dpslwk commented Sep 18, 2023

any movement on this?
php 8.2 has been out for 9 months, 8.1 leaves active support in 2 months and 8.3 is already on RC2

@davidearl
Copy link

Debian 12 Bookworm is now out, where PHP8.2 is the standard install. PHP8.1 drops out of active support in only 1 month.

This problem is starting to become urgent.

@edouard-protected-eu
Copy link

A temporary solution is to use the attached patch with the package cweagans/composer-patches :

{
    "name": "acme/demo",
    "version": "1.0.0",
    "require": {
        "gocardless/gocardless-pro": "^5.3.0",
        "cweagans/composer-patches": "^1.7"
    },
    "config": {
        "allow-plugins": {
            "cweagans/composer-patches": true
        }
    },
    "extra": {
        "patches": {
            "gocardless/gocardless-pro": {
                "Fix issue gocardless/gocardless-pro #155": "./gocardless-pro-php-issue-155.patch"
            }
        },
        "composer-exit-on-patch-failure": true
    }
}

By adding this to your composer.json, it will automatically patch gocardless-pro-php to remove the warnings

gocardless-pro-php-issue-155.patch

@colincameron
Copy link

PHP 8.1 is now out of active support and 8.3 has been released. Is there any update on this issue?

@davedevelopment
Copy link

Is this likely to be fixed any time soon? We're at a point where we need to fork and maintain our own version or make infrastructure changes to ignore logs from these deprecations.

@tomroyal
Copy link

I contacted GoCardless support yesterday, received only the following:

The Engineering team is aware of this issue and has it on their to-do list. Sadly, we are not able to confirm the timeline for when this will be resolved.

¯_(ツ)_/¯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants