I think we should update the deprecated constructors. Though this deprecation was recently introduced it seems like an easy update. Managed to list 4 of them using a compatibility checker.

File: /home/lz/sites/moneysuite/ms_core/gateways/ms_paypal_wps/includes/ms_paypal_wps_class.php
 Line 14: PHP 4 constructors are now deprecated
    function ms_paypal_wps_class($ipn_vars = NULL)
    {
    }


File: /home/lz/sites/moneysuite/ms_core/gateways/ms_ibis/Merchant.php
 Line 51: PHP 4 constructors are now deprecated
    function Merchant($url, $keystore, $keystorepassword, $verbose = 0)
    {
    }


File: /home/lz/sites/moneysuite/ms_core/gateways/ms_realex/ms_realex.class.php
 Line 19: PHP 4 constructors are now deprecated
    function RealexRemote($url, $xml)
    {
    }


File: /home/lz/sites/moneysuite/ms_affiliates/includes/ms_paypal_wps_class.php
 Line 18: PHP 4 constructors are now deprecated
    function ms_paypal_wps_class($ipn_vars = NULL)
    {
    }

Draft:

  function __construct($ipn_vars = NULL) {
    $this->ipnLink = (isset($ipn_vars['test_ipn']) AND $ipn_vars['test_ipn']) ? 'https://www.sandbox.paypal.com/cgi-bin/webscr' : 'https://www.paypal.com/cgi-bin/webscr';
    $this->ipn_vars = $ipn_vars;
    $this->lastError = '';
    $this->ipnResult = '';
  }  
 
  function ms_paypal_wps_class($ipn_vars = NULL) {
    self::__construct();  
  }

Ref:
https://cweiske.de/tagebuch/php4-constructors-php7.htm

Comments

dlz21 created an issue. See original summary.

Farreres’s picture

Heh, no idea what you mean. Maybe some other one can help with this...

clivem’s picture

understand the changes you are suggesting, need to check that the changes would work ok with php 7

vaccinemedia’s picture

Any update on this? We have just upgraded php to 7 and getting the following notice:

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ms_paypal_wps_class has a deprecated constructor in /path/to/site/sites/all/modules/contrib/moneysuite/ms_core/gateways/ms_paypal_wps/includes/ms_paypal_wps_class.php on line 8

vaccinemedia’s picture

Here's a patch updating the 4 offending classes above.

vaccinemedia’s picture

Status: Active » Needs review
clivem’s picture

Hi vaccinemedia, updated the dev version with your patch. please test in your system and let us know of any issues.

vaccinemedia’s picture

@Clivem I've noticed some of my patches have been committed into the new version but have not been attributed to myself so I do not get credit for these. Also these issues which are not in the new version of the module have not been closed. In future, these issues need to have proper accreditation and if they o into a future stable release then they also need to be closed also on Drupal.org.

Farreres’s picture

Vaccine, I'll take some time during the next days to upload pending patches into dev. I can't test them though, but as they are going to be loaded into dev, if they cause any problem we can remove them.