No Code Attached Yet
avatar infograf768
infograf768
20 Sep 2023

Steps to reproduce the issue

Install a new 4.3.4 adding 2 languages fr-FR and es-ES
Then Install multilingual data
Then, while you are in the en-GB admin , install blog sample data.
Swtch language to French and install blog sample data
Switch language to Spanish and install blog sample data : it fails when creating menu type.

Screenshot 2023-09-19 at 10 54 31

Where the problem comes from:

The code in blog.php

$menu = [
                'id'          => 0,
                'title'       => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_MENU_' . $i . '_TITLE') . $langSuffix,
                'description' => Text::_('PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_MENU_' . $i . '_DESCRIPTION'),
            ];

            // Calculate menutype. The number of characters allowed is 24.
            $type = HTMLHelper::_('string.truncate', $menu['title'], 23, true, false);

In English no problem because the title is short, but it breaks in French and Spanish as Spanish tries to save the same menu type as French, i.e. "menu-principal-blog" (without the lang suffix).

Ini string for French is
PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_MENU_0_TITLE="Menu principal blog"

Ini string in Spanish is
PLG_SAMPLEDATA_BLOG_SAMPLEDATA_MENUS_MENU_0_TITLE="MenĂº principal - Blog"

Therefore we get:

0main-menu-blog-en-gb = 21 characters
0menu-principal-blog-fr-fr = 26 characters
0menu-principal-blog-es-es = 26 characters

The Title of the Menu Type is limited to 24 characters in sql, therefore the bug.

CREATE TABLE IF NOT EXISTS #__menu_types (
  id int unsigned NOT NULL AUTO_INCREMENT,
  asset_id int unsigned NOT NULL DEFAULT 0,
  menutype varchar(24) NOT NULL,
  title varchar(48) NOT NULL,
  description varchar(255) NOT NULL DEFAULT '',
  client_id int NOT NULL DEFAULT 0,
  PRIMARY KEY (id),
  UNIQUE KEY idx_menutype (menutype)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;

and then for menu items
menutype varchar(24) NOT NULL COMMENT 'The type of menu this item belongs to. FK to #__menu_types.menutype',

Screenshot 2023-09-20 at 10 16 09

`
No idea why the title is limited.
Possible solutions:

  1. Increase the VARCHAR at least in 5.x
  2. Inform and check each TT package of the possible error and how to correct.
avatar infograf768 infograf768 - open - 20 Sep 2023
avatar joomla-cms-bot joomla-cms-bot - change - 20 Sep 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 20 Sep 2023
avatar infograf768 infograf768 - change - 20 Sep 2023
The description was changed
avatar infograf768 infograf768 - edited - 20 Sep 2023
avatar infograf768 infograf768 - change - 20 Sep 2023
The description was changed
avatar infograf768 infograf768 - edited - 20 Sep 2023
avatar chmst
chmst - comment - 20 Sep 2023

How nice to see you, @infograf768 :)

I ask myself since ever why we have the menu title as a string and the user must enter it by himself.
It is nothing else that a identifier.

Removing the field and using the ID would be the best but could be a b/c break and is a larger action. Couldn't we insert the id automatically, for example 05-en-gb instead of 0-main-menu-blog-en-gb?

avatar richard67
richard67 - comment - 20 Sep 2023

The limitation to 24 characters is there since 2009. So that is nothing new.

avatar alikon alikon - change - 20 Sep 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-09-20 16:54:21
Closed_By alikon
avatar alikon
alikon - comment - 20 Sep 2023

please check #41842

avatar alikon alikon - close - 20 Sep 2023

Add a Comment

Login with GitHub to post a comment