VirtueMart Forum

VirtueMart 2 + 3 + 4 => Plugins: Payment, Shipment and others => Topic started by: macigatto on July 31, 2022, 09:24:16 AM

Title: plugin vmshipment error with PHP 8 with set weight_countries
Post by: macigatto on July 31, 2022, 09:24:16 AM
hello,please help me

joomla 3.10.10
vm 3.8.8

when i have move from PHP 7 to PHP 8 i got this error.
I have some countries with shipment cost set with weight.
In these it is not possible to complete order for this error:

implode(): Argument #2 ($array) must be of type ?array, string given
Call stack
#   Function   Location
1   ()   JROOT/administrator/components/com_virtuemart/plugins/vmpsplugin.php:1072
2   implode()   JROOT/administrator/components/com_virtuemart/plugins/vmpsplugin.php:1072
3   vmPSPlugin->checkConditions()   JROOT/plugins/vmshipment/weight_countries/weight_countries.php:246
4   plgVmShipmentWeight_countries->checkConditions()   JROOT/administrator/components/com_virtuemart/plugins/vmpsplugin.php:934
5   vmPSPlugin->getSelectables()   JROOT/administrator/components/com_virtuemart/plugins/vmpsplugin.php:225
6   vmPSPlugin->onCheckAutomaticSelected()   JROOT/administrator/components/com_virtuemart/plugins/vmpsplugin.php:207
7   vmPSPlugin->plgVmOnCheckAutomaticSelected()   JROOT/libraries/joomla/event/event.php:70
8   JEvent->update()   JROOT/libraries/joomla/event/dispatcher.php:160
9   JEventDispatcher->trigger()   JROOT/components/com_virtuemart/helpers/cart.php:2048
10   VirtueMartCart->checkAutomaticSelectedPlug()   JROOT/administrator/components/com_virtuemart/helpers/calculationh.php:1628
11   calculationHelper->calculateMethodPrice()   JROOT/administrator/components/com_virtuemart/helpers/calculationh.php:1670
12   calculationHelper->calculateShipmentPrice()   JROOT/administrator/components/com_virtuemart/helpers/calculationh.php:967
13   calculationHelper->getCheckoutPrices()   JROOT/components/com_virtuemart/helpers/cart.php:2162
14   VirtueMartCart->getCartPrices()   JROOT/components/com_virtuemart/helpers/cart.php:2261
15   VirtueMartCart->prepareCartData()   JROOT/components/com_virtuemart/controllers/cart.php:86
16   VirtueMartControllerCart->display()   JROOT/libraries/src/MVC/Controller/BaseController.php:702
17   Joomla\CMS\MVC\Controller\BaseController->execute()   JROOT/components/com_virtuemart/virtuemart.php:115
18   require_once()   JROOT/libraries/src/Component/ComponentHelper.php:402
19   Joomla\CMS\Component\ComponentHelper::executeComponent()   JROOT/libraries/src/Component/ComponentHelper.php:377
20   Joomla\CMS\Component\ComponentHelper::renderComponent()   JROOT/libraries/src/Application/SiteApplication.php:194
21   Joomla\CMS\Application\SiteApplication->dispatch()   JROOT/libraries/src/Application/SiteApplication.php:233
22   Joomla\CMS\Application\SiteApplication->doExecute()   JROOT/libraries/src/Application/CMSApplication.php:225
23   Joomla\CMS\Application\CMSApplication->execute()   JROOT/index.php:49

thanks to help

Title: Re: plugin vmshipment error with PHP 8 with set weight_countries
Post by: pinochico on July 31, 2022, 20:17:12 PM
back to PHP7
Title: Re: plugin vmshipment error with PHP 8 with set weight_countries
Post by: GJC Web Design on July 31, 2022, 22:04:28 PM
btw fixed in the VM 4 series
Title: Re: plugin vmshipment error with PHP 8 with set weight_countries
Post by: macigatto on August 01, 2022, 09:27:49 AM
do you mean that VM 3.8.8 do not support PHP 8?

thank you
Title: Re: plugin vmshipment error with PHP 8 with set weight_countries
Post by: GJC Web Design on August 01, 2022, 11:47:26 AM
Quotedo you mean that VM 3.8.8 do not support PHP 8?

Most probably .. from memory debugging for php8 started with the VM4 series
Title: Re: plugin vmshipment error with PHP 8 with set weight_countries
Post by: macigatto on August 03, 2022, 11:28:25 AM
hello,
I have tried with VM 4.0.6
but still this error with PHP 8.
I think it is a bug to resolve.
0 - implode(): Argument #2 ($array) must be of type ?array, string given
thank you
Title: Re: plugin vmshipment error with PHP 8 with set weight_countries
Post by: macigatto on August 03, 2022, 12:04:16 PM
I have resolved putting a try catch to manage the error:

JROOT/plugins/vmshipment/weight_countries/weight_countries.php:245

try{
      $result[$hash] = parent::checkConditions($cart, $method, $cart_prices);
         }
         catch (Throwable $e) {
                     
                    }

Title: Re: plugin vmshipment error with PHP 8 with set weight_countries
Post by: e-trader on December 03, 2022, 20:40:59 PM
Will this be updated in a new VM release?
4.0.6 10690 AIO still has the PHP8 bug.
Have to stay on PHP7 in the meanwhile....