This was a pretty difficult bug to track down.
Menu item table is as before install and uninstall of the component.
Joomla\CMS\Table\Menu::_getNode(1, ) failed.
is shown.Joomla 3.8.3
I believe this issue is related with #7199 #6778 and issues reported on other extension developer like this one: https://www.regularlabs.com/forum/extensionmanager/27388-impossible-to-install
Labels |
Added:
?
|
Category | ⇒ | Components |
update - it installs when i switch to NOT use the PDO driver
I can confirm this bug
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax;
The component was made using Component Creator. Do you think this is a general Component Creator bug or a Joomla one or a PDO one. Should we look into it, I guess is my question?
probably a CC issue
Status | New | ⇒ | Discussion |
Labels |
Added:
J3 Issue
|
Hello,
I have been researching about this issue and i saw that joomla execute a delete command in the menu table where the only filter fields are lft and rgt. e.g: delete from #__menu where rgt between 2 and 5. This sql deletes some menu rows that they are not relationed with the extension is being installed. This could be seen activating mysql redo log and installing this extension. How can you see this:
1.I did a backup of menu table.
2. I installed the extension.
3. I recover the backup done in step 1.
4. I searched into redo log for delete on manu table. Delete #__menu where XXXX.
5. I executed a select sql: select * from #__menu where XXXX. This sql showed me the rows deleted, and they didn't belong to the installed extension.
May be the lft and rgt fields setted when the extension is being installed are wrong. May be the delete query should not be executed when installing an extension. May be there is needed add to where the primary key to the where.
best regards,
José M.
@jmeStark That sounds like you have a corrupt nested set table there. Because lft and rgt should indeed mark the "end" of the component specific menu tree.
Of course, using backup and restore will break your menu table if you installed an extension between. lft and rgt values change almost always as soon as you manipulate any menuitem.
I've read it, yes. I just thought it may be a different case which emerged due to restoring single table backups (which wont work well).
As for your description, the second image shows indeed also a wrong nested set. The level, lft and rgt values are wrong for com_test. Level should be 1, lft should be at least 1 as well, never 0.
So to me it looks like the issue isn't happening when deleting, instead it happens when creating the menuitems.
I haven't debugged it with your test component. Just from reading here. Maybe that helps someone else find the source.
Yes. As reported it starts breaking when installing the component but mostly have a huge impact on the user when uninstalling.
The issue comes indeed from your duplicated menuitem. The installer tries to create the duplicate and it fails because the alias is already present.
This fail now triggers a code block to deal with that:
joomla-cms/libraries/src/Installer/Adapter/ComponentAdapter.php
Lines 1335 to 1376 in ff7addc
lft
argument to that rebuild method. As it is, the method rebuilds the set and puts the items to lft=0
, which is wrong.
So there is a bug in the installer, but you will still not be able to have two identical named menuitems. Rename your duplicated menuitem to another name and it should work.
Nice work. I agree it should not be possible to have two identical view names, but it should not create this much havoc with your installation. I propose that the installer simply fails if there are two identical menu views in the extension?
I'd rather fix the rebuild call
Closing as we have a PR.
Status | Discussion | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-05-17 07:56:05 |
Closed_By | ⇒ | Bakual |
Tried to install your test component and it failed to install with the following
Warning
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '??SHOW FULL COLUMNS FROM
bb5yp_test_items
WHERE Field LIKE 'id'??' at line 1×
Error
Error installing component