No Code Attached Yet
avatar Molasar49
Molasar49
8 Apr 2025

Steps to reproduce the issue

  1. Go to Modules and select a module.
  2. Click "Duplicate" and observe the error.

Expected result

No error should occur.

Actual result

The module does get duplicated without any apparent trouble.

System information (as much as possible)

PHP Built On: Linux test-environment 6.8.0-57-generic 59-Ubuntu SMP PREEMPT_DYNAMIC Sat Mar 15 17:40:59 UTC 2025 x86_64
Database Type: mysql
Database Version: 8.0.41-0ubuntu0.24.04.1
Database Collation: utf8mb4_unicode_ci
Database Connection Collation: utf8mb4_0900_ai_ci
Database Connection Encryption: None
Database Server Supports Connection Encryption: Yes
PHP Version: 8.2.28
Web Server: Apache/2.4.58 (Ubuntu)
WebServer to PHP Interface: apache2handler
Joomla! Version: Joomla! 5.2.6 Stable [ Uthabiti ] 8-April-2025 16:00 GMT
Joomla Backward Compatibility Plugin: Enabled (classes_aliases:"1", es5_assets:"1")
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:137.0) Gecko/20100101 Firefox/137.0

Additional comments

Error also occurs on Windows and other browsers.
This error did not occur before J5.2.5. Persistent on J5.2.6
SP Page Builder v5.5.4 installed, HOWEVER, the module being duplicated is a standard Custom module with 3 lines of PHP code to add a datatable.
Helix Ultimate v2.1.2 installed.
Template is vhost_free_j5_2.1.9

As said before, error did not occur prior to J5.2.5.

This error was also reported in #44913 by someone else, but seems other folks could not reproduce the error.

Screenshots:

Image

Image

avatar Molasar49 Molasar49 - open - 8 Apr 2025
avatar joomla-cms-bot joomla-cms-bot - change - 8 Apr 2025
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 8 Apr 2025
avatar Molasar49 Molasar49 - change - 8 Apr 2025
The description was changed
avatar Molasar49 Molasar49 - edited - 8 Apr 2025
avatar Molasar49 Molasar49 - change - 8 Apr 2025
The description was changed
avatar Molasar49 Molasar49 - edited - 8 Apr 2025
avatar fgsw
fgsw - comment - 9 Apr 2025

@Molasar49 Test to duplicate a custom module and can't confirm the reported issue on a clean joomla installation using core components and no 3rd party extensions.

System Information

PHP Built On Linux lamp401.cloudaccess.net 5.14.0-503.15.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Nov 28 07:25:19 EST 2024 x86_64
Database Type mysql
Database Version 10.11.11-MariaDB-cll-lve
Database Collation utf8mb3_general_ci
Database Connection Collation utf8mb4_general_ci
Database Connection Encryption None
Database Server Supports Connection Encryption No
PHP Version 8.3.19
Web Server Apache
WebServer to PHP Interface litespeed
Joomla! Version Joomla! 5.2.6 Stable [ Uthabiti ] 8-April-2025 16:00 GMT
Joomla Backward Compatibility Plugin Enabled (classes_aliases:"1", es5_assets:"1")
User Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:137.0) Gecko/20100101 Firefox/137.0

avatar brianteeman
brianteeman - comment - 9 Apr 2025
  1. Please go to your database and see what is the value for the column access in the table #__modules for the module you created that gave you the problem
  2. Please go to the database and check the values in the table #__usergroups
avatar Molasar49
Molasar49 - comment - 9 Apr 2025

Ok, here are the steps I took to replicate the problem. First, the #__usergroups table:

Image

  1. I started with a brand new custom module. Eveything is default except the php code (to display some random table):

Image

  1. Saved the module. No problems there:

Image

  1. Check the #__modules table:

Image

  1. Everything appears normal:

Image

  1. Duplicate the module:

Image

  1. Upon duplicating, error appears:

Image

  1. Check the #__modules table. (Notice asset_id appears as 0; don't know if that's normal):

Image

  1. Duplicated module appears to cause no trouble:

Image

  1. I can publish it can use it elsewhere no problem:

Image

Image

  1. Once published, asset_id gets updated with a value:

Image

Please let me know if you need any further testing, etc. I'm a .NET programmer, so I can more or less navigate my way across php and js code, etc., if needed.

Thanks!

avatar chmst
chmst - comment - 9 Apr 2025

Are you using the sourcerer?
Could you replace the content of this module by a normal text and see if anything changes?

avatar Molasar49
Molasar49 - comment - 9 Apr 2025

Done.

  1. Changed content of module to normal text:

Image

  1. Saved:

Image

  1. Duplicated it:

Image

  1. Same error displayed:

Image

Please let me know if you need any further tests, changes, etc.

Thanks!

avatar Molasar49 Molasar49 - change - 10 Apr 2025
The description was changed
avatar Molasar49 Molasar49 - edited - 10 Apr 2025
avatar chmst
chmst - comment - 13 Apr 2025

Could you change your environment and database collation? Maybe make a copy of your Installation.
I cannot replicate on any of my installations, with collation = utf8mb4_unicode_ci in the database.
No idea if this makes a difference.

avatar Molasar49
Molasar49 - comment - 14 Apr 2025

Can someone kindly point me to the path and file (and approximate lines of code) that get invoked when duplicating a module? Maybe I can figure out what variables are getting sent to the SQL command to insert, etc. Any help would be greatly appreciated.

avatar Molasar49
Molasar49 - comment - 15 Apr 2025

Found it:

administrator/components/com_modules/src/Model/ModuleModel.php
public function duplicate(&$pks)

/libraries/src/Table/Module.php
public function store($updateNulls = true)

/libraries/src/Table/Table.php
public function store($updateNulls = false)

Will post my findings.

Thanks

avatar chmst
chmst - comment - 15 Apr 2025

Just at the same place. in _getAssetPartentsId().
I see some old code - but it is not wrong. It could only fail if is something wrong in your #__assets table.

avatar Molasar49
Molasar49 - comment - 15 Apr 2025

Well, this is strange...

So I put this here, in /libraries/vendor/joomla/database/src/Mysqli/MysqliDriver.php to catch the SQL statements:

Image

I created a standard Custom Module with 'This is a test' (sans quotes) as the content. No errors on save.

I then duplicated it. Got the same (original) error. My 'log' showed this:

INSERT INTO `#__modules`
(`id`,`title`,`note`,`content`,`ordering`,`position`,`published`,`module`,`access`,`showtitle`,`params`,`client_id`,`language`) VALUES 
('0','Test_Module','','<p>This is a test</p>','1','','1','mod_custom','1','1','{\"prepare_content\":0,\"backgroundimage\":\"\",\"layout\":\"_:default\",\"moduleclass_sfx\":\"\",\"cache\":1,\"cache_time\":900,\"cachemode\":\"static\",\"module_tag\":\"div\",\"bootstrap_size\":\"0\",\"header_tag\":\"h3\",\"header_class\":\"\",\"style\":\"0\"}','0','*')


INSERT INTO `#__assets`
(`parent_id`,`level`,`lft`,`rgt`,`name`,`title`,`rules`) VALUES 
('18','2','224','225','com_modules.module.205','Test_Module','{}')


INSERT INTO `#__action_logs`
(`message_language_key`,`message`,`log_date`,`extension`,`user_id`,`ip_address`,`item_id`) VALUES 
('PLG_SYSTEM_ACTIONLOGS_CONTENT_ADDED','{\"action\":\"add\",\"type\":\"PLG_ACTIONLOG_JOOMLA_TYPE_MODULE\",\"id\":205,\"title\":\"Test_Module\",\"extension_name\":\"Test_Module\",\"itemlink\":\"index.php?option=com_modules&task=module.edit&id=205\",\"userid\":834,\"username\":\"admin\",\"accountlink\":\"index.php?option=com_users&task=user.edit&id=834\"}','2025-04-15 20:07:45','com_modules.module','834','COM_ACTIONLOGS_DISABLED','205')


INSERT INTO `#__modules`
(`id`,`title`,`note`,`content`,`ordering`,`position`,`published`,`module`,`access`,`showtitle`,`params`,`client_id`,`language`) VALUES 
('0','Test_Module (2)','','<p>This is a test</p>','1','','0','mod_custom','1','1','{\"prepare_content\":0,\"backgroundimage\":\"\",\"layout\":\"_:default\",\"moduleclass_sfx\":\"\",\"cache\":1,\"cache_time\":900,\"cachemode\":\"static\",\"module_tag\":\"div\",\"bootstrap_size\":\"0\",\"header_tag\":\"h3\",\"header_class\":\"\",\"style\":\"0\"}','0','*')


INSERT INTO `#__assets`
(`parent_id`,`level`,`lft`,`rgt`,`name`,`title`,`rules`) VALUES 
('18','2','226','227','com_modules.module.206','Test_Module (2)','{}')

No lines after that...

Guessing that only the second INSERT 'must' contain the error (because of the 'access' field), I copied it to MySQL Workbench, modified the title (second field) and ran it. Forgot to change the table prefix on the first try (which is why I got an error), but after fixing that, it ran without problems...

Image

I didn't run the assets and action_logs INSERTs, though.

Any thoughts?

Thanks!

avatar chmst
chmst - comment - 28 Apr 2025

Still unable to replicate that. ICould it be a wrong entry in your #__asset table? But it is really hard to check nested sets.

You could make a copy of your site, then replace the #__assets table by a #__assets table from a fresh installation. Just for test. This of course removes all existing permissions and is not a solution. But would give a hint if the poblem is the #__asset table itself.

As nobody can replicate this or opened a similiar issue, I cannot believe that it is a bug in Joomla core.

avatar Molasar49
Molasar49 - comment - 28 Apr 2025

Hi, just as a reminder. Someone else did open a similar case before: #44913

avatar chmst
chmst - comment - 28 Apr 2025

ahh.. thank you! Really strange.

Add a Comment

Login with GitHub to post a comment