?
avatar ReLater
ReLater
29 Jul 2021

Steps to reproduce the issue

  • The issue is for sure not reproducable for everybody. As far as I see it has to do with the performance of the server environment.
  • Current nightly. Very little installed and very few entries in the database.
  • Go to Menus > Manage.
  • Set filter on Administrator to create a backend menu.
  • Click button New.
  • Enter Title and Alias.
  • Field Import a preset: Select Preset Alternative Main Menu.
  • Save & Close or just Save

Expected result

  • All menu items from preset saved.

Actual result

  • I get a message like
Menu was saved but failed to import the preset: The alias 1627514907-04 is already being used by - menu item in the asdfgh menu (remember it may be a trashed item).

(asdfgh is the alias/menutype I entered in this case).

The image shows several tests that resulted in different numbers of menu items but the last one (red arrow) where I have manipulated tha alias creation in MenusHelper.php for separator types before.

29-07-_2021_01-54-09

I located the error here: https://github.com/joomla/joomla-cms/blob/4.0.0-rc5/administrator/components/com_menus/src/Helper/MenusHelper.php#L509

Looks like microtime(true) is not reliable enough in faster environments to create unique aliases.

My temporary but bad (also a bit lottery ?) fix is

$item->alias = microtime(true) . '-' . uniqid();

System information (as much as possible)

  • 10.5.11-MariaDB-1:10.5.11+maria~focal-log
  • PHP 8.0.6 (Linux dd51328 5.4.0-80-generic # 90-Ubuntu SMP Fri Jul 9 22:49:44 UTC 2021 x86_64 )

Additional comment

-It is normal that in each additional menu with preset altenate.xml 1 more menu entry is added, but only 1.

avatar ReLater ReLater - open - 29 Jul 2021
avatar joomla-cms-bot joomla-cms-bot - change - 29 Jul 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 29 Jul 2021
avatar ReLater ReLater - change - 29 Jul 2021
The description was changed
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-07-29 13:59:22
Closed_By ReLater
avatar ReLater ReLater - close - 29 Jul 2021
avatar ReLater
ReLater - comment - 29 Jul 2021

See pr #34974

Add a Comment

Login with GitHub to post a comment