Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I am running in the following two errors on my setup:
Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; SofortLibLogger has a deprecated constructor in require_once() (line 36 of /home/.sites/882/site6321404/web/dev/sites/all/modules/commerce_sofortbanking/library/sofortLib.php).
Deprecated function: Methods with the same name as their class will not be constructors in a future version of PHP; PnagCustomer has a deprecated constructor in require_once() (line 4 of /home/.sites/882/site6321404/web/dev/sites/all/modules/commerce_sofortbanking/library/helper/class.abstract_document.inc.php).
I do not get this errors with PHP 5.6 - but I would really like to use PHP 7. Any plans on this being addressed?
Thank you for this module.
Comment | File | Size | Author |
---|---|---|---|
#4 | commerce_sofortbanking-php7-2885884-4.patch | 1.33 KB | drupov |
Comments
Comment #2
drupov CreditAttribution: drupov commentedSame for me.
Looking at the code at https://github.com/sofort/sofortlib-php, which is also what is referred by SOFORT themselves https://www.sofort.com/integrationCenter-eng-DE/integration/API-SDK#2861... I can see that the library there is not identical to what the module uses in under its' library subfolder.
The GitHub code is supposed to support PHP 7 (see the commits there), maybe the whole SDK changed after the Drupal module implementation.
Comment #3
jurgenhaasThanks for reporting this. It sounds as if you can still use this with PHP 7 as what you're getting is a deprecation hint for a future version of PHP. That means, it is still working but may not in one of the future PHP versions, most likely not before PHP 8.
The message you're seeing is "just" for information and in your production environment, that should not be vissible to your website visitors.
Now, with regard to potentially changing the library to resolve this deprecation information completely, I'm not sure what's the best approach. Replacing the library sounds like a really bad idea as we don't seem to have any budget to go through the whole module to make sure it is still working as before. Instead, for this simple matter it would probably be best, to patch the used library to make it fully PHP 7 compliant. Anyone around who can privde a patch for that?
Comment #4
drupov CreditAttribution: drupov commentedReplacing the library at this point is definitely a huge thing.
As it is packaged with the module it might be enough to just replace/rename the method names that are the same as their class with the __contstruct method.
Comment #6
jurgenhaas@drupov thanks for your patch, I've just committed that to the dev release.