News:

Looking for documentation? Take a look on our wiki

Main Menu

Problem in getProductCategories, Virtuemart 3.2.2

Started by bcohen0, August 28, 2017, 01:00:33 AM

Previous topic - Next topic

bcohen0

Yes, I know I have to update, and I will, but I don't think it will affect this issue.

This is in administrator/components/com_virtuemart/models/product.php, in function getProductCategories.  There is a line which casts an object to array, and it is throwing some kind of exception or something. I can't get closer to it because my debugger goes haywire at the call, or an attempt to do the object cast.

The original line is
            $tmp = (array)$catTable->load($categoryId['virtuemart_category_id']);

The casting is throwing into neverland. I can't do an evaluate expression either. When I change the cast to get_object_vars, all is well.

            $tmp = get_object_vars($catTable->load($categoryId['virtuemart_category_id']));

I'm wondering, if tmp doesn't need the private parts or methods of the table, perhaps using get_object_vars is better/safer?
I've looked at the uncast object returned by the load and I don't see anything obviously wrong with it, with my inexperienced eye.




Milbo

You use php7, right? It would explain, why it is suddenly a problem.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

bcohen0

Oh! No, I don't, I'm working on my client's system, and he doesn't.  Thanks for the info. I'll try it out.

Milbo

Quote from: bcohen0 on August 28, 2017, 01:00:33 AM
The original line is
            $tmp = (array)$catTable->load($categoryId['virtuemart_category_id']);

The original line is now $tmp = $catTable->load($categoryId['virtuemart_category_id'])->loadFieldValues(); and the loadFieldValues does the array
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

bcohen0

#4
Thank you! I have updated, I see this change now.