Author Topic: Function plgVmOnPaymentNotification in payment plugins without parameter  (Read 103 times)

gba

  • Jr. Member
  • **
  • Posts: 268
Hi plugin developers!

We just ran into problems, if we used the function 'plgVmOnPaymentNotification' in our own payment plugin.
After updating to VM 3.2.14 this function has a new definition now.

Old definition:
Code: [Select]
function plgVmOnPaymentNotification(&$html)
New definition:
Code: [Select]
function plgVmOnPaymentNotification()
As you can see, the function now does not have any parameter anymore.

We found that out, because a payment provider could not notify VM anymore, as the old function definition produces an error now:
"Error: 0 Too few arguments to function plgVmPaymentOurPaymentMethod::plgVmOnPaymentNotification(), 0 passed in /home/www/gmr/libraries/joomla/event/event.php on line 70 and exactly 1 expected"

As soon as we removed the parameter, the problems where gone.
Maybe this information is helpful also for someone else.

BTW:
Do we need to run into problems to find out such (quite essential) code changes in VM, or is there any information source about necessary changes for third party extensions to be able to keep them up-to-date with VM before updating to each next version?

Kind regards,
Gerald

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1445
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
This sounds like a strange issue, how old is Your plugin ?
What VM version have You updated from ?

I can see this so called "new" declaration to be used already in VM version 3.0.6 from may 2015, three years ago....

Who has developed "Your" plugin ?

regards

Jörgen @ Kreativ Fotografi
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

gba

  • Jr. Member
  • **
  • Posts: 268
Hi!

I developed it myself and used it without issues with VM 3.2.12.
But I guess moving from PHP 7.0 to 7.2 now brought that issue up.

Quote
BTW:
Do we need to run into problems to find out such (quite essential) code changes in VM, or is there any information source about necessary changes for third party extensions to be able to keep them up-to-date with VM before updating to each next version?
Do you have any hint for me?

Kind regards,
Gerald

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1445
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
I do not know where You got your declaration from, but this function has not had any parameters as far as I know. Check the PayPal plugin as an example for how to design the calls. PHP seven has a stricter type check than PHP five and but this does not make an badly designed call better. It was wrong from the beginning and most certainly not caused by a VM update.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 26841
  • Always on vacation
    • Jenkin Hill Internet
AFAIK there are still some issues with PHP7.2, I don't recommend any higher than 7.1 and I'm staying at 7.0 for most of my websites. The advice given on the Joomla facebook group is still to use no higher than 7.1 with the current Joomla version.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM.3.2.15.9866 on Joomla 3.8.8 PHP 7.0.30

Testing VM.3.2.15.9866 on J3.8.8