News:

Support the VirtueMart project and become a member

Main Menu

Illegal Offset in product.php in $_cacheOpt

Started by WebStuff, July 04, 2023, 21:13:51 PM

Previous topic - Next topic

WebStuff

VirtueMart 4.0.22 10864
Joomla! 3.10.11

I'm getting and Illegal Offset from file [ROOT}/administrator/components/com_virtuemart/models/product.php
I've tracked it down to line 1168  :
self::$_cacheOpt[$virtuemart_product_id] = $opt;
The $virtuemart_product_id is a string at this point so gives the error.
If (int) is added it sorts the problem thus:
self::$_cacheOpt[(int)$virtuemart_product_id] = $opt;

I've looked at the code but can't see why it's having a problem with a string as an offset but as it seems to work hopefully this is okay.
Wondering if it's because the $virtuemart_product_id is NULL as that's the "default" set in the function if there's no id passed.