VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: CZDave on January 04, 2021, 09:36:46 AM

Title: 3.8.6 and 3.8.7 possible bug in helpers/cart.php
Post by: CZDave on January 04, 2021, 09:36:46 AM
Hi,

I'm a developer of ARTIO VM Invoice 3 component. Our clients started to have problems with some functionality after updating VirtueMart to 3.8.6.10373 and 3.8.7.10378 with the following error message:

"Call to a member function set() on null: .../components/com_virtuemart/helpers/cart.php:263"

I've checked the code in that file and it seems that on the mentioned line number 263 there is the following code in function getCart():

$session->set('vmcartlastVendorId', $vendorId, 'vm');

But the $session variable might not be defined - if we pass some data to $cartData argument of the getCart() function, the $session variable will not be initialized. Could you please check this?

Thank you.
Title: Re: 3.8.6 and 3.8.7 possible bug in helpers/cart.php
Post by: Milbo on January 04, 2021, 22:00:59 PM
The  new version has at line 117


$session = JFactory::getSession($options);


That should fix it, or?
Title: Re: 3.8.6 and 3.8.7 possible bug in helpers/cart.php
Post by: CZDave on January 05, 2021, 09:18:12 AM
Which new version do you mean? I've just checked 3.8.7.10378 and there's the following code:


$multixcart = VmConfig::get('multixcart',0);

if(empty($multixcart)){
    $vendorId = 1;
    //vmdebug('No Multicart vendorId = 1');
} else {
    if($vendorId === NULL){
        $session = JFactory::getSession($options);


So the $session gets initialized there only when multi-vendor cart handling is enabled.
Title: Re: 3.8.6 and 3.8.7 possible bug in helpers/cart.php
Post by: GJC Web Design on January 05, 2021, 11:36:54 AM
I guess Max means to add this at the start of the function

is already fixed in 3.8.7.10380 - soon to be 3.8.8

Title: Re: 3.8.6 and 3.8.7 possible bug in helpers/cart.php
Post by: CZDave on January 05, 2021, 14:48:20 PM
Great, thanks, will tell our customers it will be fixed in 3.8.8.

Have a nice day