Useless IS NULL check on menu item load

  • Posts: 31
  • Thank you received: 2
18 hours 45 minutes ago #373351

-- HikaShop version -- : 6.6.0
-- Joomla version -- : 6.1.3
-- PHP version -- : 8.4

hikashopMenusClass filters all loaded menu items via "b.title IS NOT NULL" where "b" is as alias of "#__menu_types" table.

"#__menu_types.title" is not a nullable column, hence this clause makes no sense, and join to #__menu_types is also completely useless.

Sorry, posted to incorrect forum, please move to Bugs.

Last edit: 18 hours 44 minutes ago by Denitz.

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

  • Posts: 86112
  • Thank you received: 14209
  • MODERATOR
14 hours 46 minutes ago #373353

Hi,

You're right on the IS NOT NULL, and I've removed it from the three queries in hikashopMenusClass, plus the two other places which had the same copy (the menu item lookup in the helper and the Smart Search plugin). It will be in the next version.

A bit of history, since it explains the shape: that filter was added in 2014 next to a LEFT JOIN, where it was the way to drop a menu item pointing at a menu type which no longer exists. The join was changed to INNER the same day and the test has done nothing since.

The join itself I'm keeping, as that is what now does the filtering the NULL test used to do: an INNER JOIN on #__menu_types excludes the menu items whose menutype has no row there. That shouldn't happen on a healthy site, but we do see databases where a menu was removed and its items stayed behind, and picking one of those for an Itemid gives a link which 404s.

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

  • Posts: 31
  • Thank you received: 2
14 hours 29 minutes ago #373360

Thanks!
Imho, this join is still useless, the problems of broken sites should be not projected on all other sites.

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

Time to create page: 0.059 seconds
Powered by Kunena Forum