Cannot Access Protected Property

  • Posts: 10
  • Thank you received: 2
2 years 10 months ago #341149

-- HikaShop version -- : 4.5.1
-- Joomla version -- : 4.1.2
-- PHP version -- : 8.1.0
-- Browser(s) name and version -- : Any
-- Error-message(debug-mod must be tuned on) -- : Cannot access protected property Joomla\CMS\Menu\MenuItem::$params

Hello again,

I created a Search filter menu item function per instructions I found on this forum and in the associated documentation. Unfortunately, I'm getting an error upon trying to Search on the front end: "Cannot access protected property Joomla\CMS\Menu\MenuItem::$params"

In an attempt to fix that, I broke my breadcrumbs - they don't follow the shop items, although sometimes it does and it'll stick on a particular item and not change. I've looked up this issue and have adjusted my SEF settings in HikaShop, but to no avail. I didn't mess with any CSS/PHP, but I also am not aware of any changes I made to breadcrumbs prior to the problem appearing.

Apologies that I cannot provide more information, as I'm not sure where to look. I've checked the logs and have tried inspecting the elements, but nothing stands out. I've attached the debug log for the error to this post - if there's anything else you need, please let me know. My website should be attached to this post.

Lastly, I'm wondering if it's normal to see so many "Deprecated" errors with debug enabled.

Thanks.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 83402
  • Thank you received: 13495
  • MODERATOR
2 years 10 months ago #341157

Hi,

Thank you. The screenshot of the callstack is great.
This error happens due to a compatibilty issue with Joomla 4 when displaying a categories listing module with a specific set of settings.
In the file components/com_hikashop/views/category/tmpl/listing_list.php try changing the code:

$hkParams = $menuItem->params->get('hk_product',false);
to:
$category_params = $menuItem->getParams();
						$hkParams = $category_params->get('hk_product',false);
That should hopefully fix the error.

The following user(s) said Thank You: jbrull

Please Log in or Create an account to join the conversation.

  • Posts: 10
  • Thank you received: 2
2 years 10 months ago #341188

Nicolas,

Thank you. I've changed the statement to the one you provided. The search function appears to work perfectly now.

I'm curious: is it normal to have so many deprecations with Debug Site turned on; is it because I'm using Joomla 4.1.2? Will these impact the performance of my site at all - is it something I should seek a fix for? For example:

"Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in x/x/x/x"
"Deprecated: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated in x/x/x/x"


Apologies to pile onto this thread, but the code change did not fix the issues I am having with breadcrumbs in HikaShop areas. I can't really explain what it's doing ... it'll seemingly show breadcrumbs as if it were on a random item's product page. Other times it doesn't show beyond "Home / Shop." They also don't extend out when moving through categories. They appear to work as expected outside of HikaShop modules. As I mentioned, I've attempted 'fixes' I've found for general breadcrumb issues on this forum, such as altering SEF settings, such as Simplified Breadcrumbs, etc. I can't seem to find anything I've yet to try while I continue to scour the web.

I have a preproduction site (/preproduction) that I make changes to before altering the live site, and it doesn't have this issue. So it's very peculiar, as I wouldn't have made a change to the live site that could've caused it without also affecting my preproduction site.

Any ideas how to approach this issue? I'm not seeing anything on Debug or my site's logs (with Log Everything enabled).

Please Log in or Create an account to join the conversation.

  • Posts: 83402
  • Thank you received: 13495
  • MODERATOR
2 years 10 months ago #341197

Hi,

1. The deprecated messages have nothing to do with your version of Joomla but your version of PHP.
They do not impact performances.
These are added by PHP to notify developers that things will change in the future and that they should modify their code to adapt to the changes to come.
So the deprecated messages you'll see on PHP 8.1 will potentially become warnings on PHP8.2 or PHP 9, and then potentially fatal errors on PHP 9 or 10.
They are purely for developers. So as a user, you can just ignore them.
The best is to report them to the developers concerned by the file path provided in the deprecated messages so that they are aware of them and can modify their code ( in HikaShop for example, we can't test all the possible cases on our end. That would be endless. So having such feedback is great to prepare for the future).

2. This looks like a caching issue with the breadcrumbs module. You need to deactivate the caching of that module as it needs to be dynamic or it won't work properly.

The following user(s) said Thank You: jbrull

Please Log in or Create an account to join the conversation.

  • Posts: 10
  • Thank you received: 2
2 years 10 months ago #341204

Nicolas,

Thanks for the information. Per your request, here’s more information about those deprecations:

  • Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /home/user/public_html/administrator/components/com_hikashop/helpers/image.php on line 793.

  • Deprecated: htmlentities(): Passing null to parameter #1 ($string) of type string is deprecated in /home/user/public_html/administrator/components/com_hikashop/classes/filter.php on line 1700.

The module is set to its default - no cache. However, System Cache got turned on somehow; upon disabling it, everything appears fixed. Thanks again!

Please Log in or Create an account to join the conversation.

  • Posts: 83402
  • Thank you received: 13495
  • MODERATOR
2 years 10 months ago #341205

Hi,

Thank you. Patches for both deprecated messages will be included in the next version of HikaShop.

Please Log in or Create an account to join the conversation.

Time to create page: 0.060 seconds
Powered by Kunena Forum