RTC bug PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar adarshdubey03
adarshdubey03
24 Feb 2026

Pull Request resolves #46751.

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

Fixes incorrect article counts in the Tags – Popular module when a content item is assigned multiple tags.

The module previously used COUNT(*), which resulted in inflated counts due to row multiplication in the many-to-many join between #__contentitem_tag_map and #__ucm_content.

This change replaces:

COUNT(*)

with:

COUNT(DISTINCT m.core_content_id)

to ensure unique content items are counted per tag.

Testing Instructions

  1. Create two tags (e.g., Tag1 and Tag2).
  2. Create Article 1 and assign both Tag1 and Tag2.
  3. Create Article 2 and assign Tag1.
  4. Create Article 3 and assign Tag1.
  5. Enable the Tags – Popular module with "Display Number of Items" enabled.

Actual result BEFORE applying this Pull Request

Tag1 → 4
Tag2 → 2

Counts are inflated when an article has multiple tags.

Expected result AFTER applying this Pull Request

Tag1 → 3
Tag2 → 1

Each tag correctly reflects the number of unique associated content items.

Additional Notes

  • core_content_id is defined as NOT NULL, making DISTINCT aggregation safe.
  • No schema changes.
  • No API changes.
  • Minimal modification (single-line change).
  • Verified with cache cleared and debug disabled.

Link to documentations

  • No documentation changes for guide.joomla.org needed
  • No documentation changes for manual.joomla.org needed
avatar adarshdubey03 adarshdubey03 - open - 24 Feb 2026
avatar adarshdubey03 adarshdubey03 - change - 24 Feb 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 24 Feb 2026
Category Modules Front End
avatar richard67
richard67 - comment - 24 Feb 2026

@adarshdubey03 Have you verified that this works not only for MySQL (or MariaDB) but also for PostgreSQL?

avatar adarshdubey03
adarshdubey03 - comment - 25 Feb 2026

Hi @richard67,

I have verified the change on PostgreSQL 16 locally in addition to MySQL/MariaDB.

To confirm the behavior, I reproduced a duplicate row scenario at the database level by simulating multiple mappings for the same core_content_id. As expected:

COUNT(*) resulted in inflated counts when duplicate mappings were present.

COUNT(DISTINCT core_content_id) correctly returned the number of unique content items per tag.

PostgreSQL fully supports COUNT(DISTINCT ...) under ANSI SQL semantics, and the behavior matches MySQL/MariaDB in this context.

The fix therefore works correctly across both supported database engines.

avatar alikon alikon - test_item - 25 Feb 2026 - Tested successfully
avatar alikon
alikon - comment - 25 Feb 2026

I have tested this item ✅ successfully on 6b3d62e

postgresql 15.15


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47218.

avatar richard67 richard67 - change - 25 Feb 2026
Title
mod_tags_popular: Fix duplicate article count caused by many-to-many …
[5.4] mod_tags_popular: Fix duplicate article count caused by many-to-many …
avatar richard67 richard67 - edited - 25 Feb 2026
avatar brianteeman brianteeman - test_item - 4 Mar 2026 - Tested successfully
avatar brianteeman
brianteeman - comment - 4 Mar 2026

I have tested this item ✅ successfully on 6b3d62e


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47218.

avatar richard67 richard67 - change - 4 Mar 2026
Status Pending Ready to Commit
Labels Added: bug PR-5.4-dev
avatar richard67
richard67 - comment - 4 Mar 2026

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/47218.

avatar muhme muhme - change - 5 Mar 2026
Labels Added: RTC
avatar muhme
muhme - comment - 5 Mar 2026

✅ Final test before merge using JBT

  • Three times, for MariaDB 10.6.25, MySQL 8.1 and PostgreSQL 15.16:
    • Before PR problem seen; Note: Creating the tags and articles straight forward does not cause the counting problem for me, there was always one more change needed in assiging second tag to third article aftwards, then both counters are wrong
    • Applied PR with Patch Tester and both counters are correct now
  • Numbers are still correct if more articles are installed from 'Blog Sample Data'
avatar muhme muhme - change - 5 Mar 2026
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2026-03-05 08:00:33
Closed_By muhme
avatar muhme muhme - close - 5 Mar 2026
avatar muhme muhme - merge - 5 Mar 2026
avatar muhme
muhme - comment - 5 Mar 2026

Thank you @adarshdubey03 for your first time contribution. Thanky you @alikon and @brianteeman for testing.

avatar adarshdubey03
adarshdubey03 - comment - 5 Mar 2026

Thank you for the review and merge!

I appreciate the testing and feedback from everyone involved.
Happy to contribute and looking forward to helping with more fixes and improvements.

Add a Comment

Login with GitHub to post a comment