PR-5.3-dev Pending

User tests: Successful: Unsuccessful:

avatar Denitz
Denitz
12 Sep 2025

Summary of Changes

Subsequent calls to $componentObject->getCategory() produce the same SQL query.

Testing Instructions

Add custom fields for articles, limit fields to category "Any Category".
Add fields values for articles from this category.
Show articles from this category in frontend, i.e. via Category Blog and show custom field values.

Actual result BEFORE applying this Pull Request

See multiple SQL query duplicates with the same params like:

SELECT `c`.`id`,`c`.`asset_id`,`c`.`access`,`c`.`alias`,`c`.`checked_out`,`c`.`checked_out_time`,`c`.`created_time`,`c`.`created_user_id`,`c`.`description`,`c`.`extension`,`c`.`hits`,`c`.`language`,`c`.`level`,`c`.`lft`,`c`.`metadata`,`c`.`metadesc`,`c`.`metakey`,`c`.`modified_time`,`c`.`note`,`c`.`params`,`c`.`parent_id`,`c`.`path`,`c`.`published`,`c`.`rgt`,`c`.`title`,`c`.`modified_user_id`,`c`.`version`, CASE WHEN CHAR_LENGTH(`c`.`alias`) != 0 THEN CONCAT_WS(':', `c`.`id`, `c`.`alias`) ELSE `c`.`id` END as `slug`
FROM `jos_categories` AS `s`
INNER JOIN `jos_categories` AS `c` ON (`s`.`lft` < `c`.`lft` AND `c`.`lft` < `s`.`rgt` AND `c`.`language` IN (:preparedArray3,:preparedArray4)) OR (`c`.`lft` <= `s`.`lft` AND `s`.`rgt` <= `c`.`rgt`)
WHERE (`c`.`extension` = :extension OR `c`.`extension` = 'system') AND `c`.`access` IN (:preparedArray1,:preparedArray2) AND `c`.`published` = 1 AND `s`.`id` = :id
ORDER BY `c`.`lft`

Expected result AFTER applying this Pull Request

Only single query with the same params.

Link to documentations

Please select:

  • No documentation changes for docs.joomla.org needed
  • No documentation changes for manual.joomla.org needed
avatar Denitz Denitz - open - 12 Sep 2025
avatar Denitz Denitz - change - 12 Sep 2025
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 12 Sep 2025
Category Libraries
e4a1920 12 Sep 2025 avatar Denitz CS
avatar Denitz Denitz - change - 12 Sep 2025
Labels Added: PR-5.3-dev
avatar ceford
ceford - comment - 18 Sep 2025

Not sure about this. With the patch applied I see the number of queries decrease by 1 but the query quoted above is still duplicated. Without the patch there are 3 instances, with the patch there are two instancies.

SELECT `c`.`id`,`c`.`asset_id`,`c`.`access`,`c`.`alias`,`c`.`checked_out`,`c`.`checked_out_time`,`c`.`created_time`,`c`.`created_user_id`,`c`.`description`,`c`.`extension`,`c`.`hits`,`c`.`language`,`c`.`level`,`c`.`lft`,`c`.`metadata`,`c`.`metadesc`,`c`.`metakey`,`c`.`modified_time`,`c`.`note`,`c`.`params`,`c`.`parent_id`,`c`.`path`,`c`.`published`,`c`.`rgt`,`c`.`title`,`c`.`modified_user_id`,`c`.`version`, CASE WHEN CHAR_LENGTH(`c`.`alias`) != 0 THEN CONCAT_WS(':', `c`.`id`, `c`.`alias`) ELSE `c`.`id` END as `slug`
FROM `kxq29_categories` AS `s`
INNER JOIN `kxq29_categories` AS `c` ON (`s`.`lft` < `c`.`lft` AND `c`.`lft` < `s`.`rgt` AND `c`.`language` IN (:preparedArray3,:preparedArray4)) OR (`c`.`lft` <= `s`.`lft` AND `s`.`rgt` <= `c`.`rgt`)
WHERE (`c`.`extension` = :extension OR `c`.`extension` = 'system') AND `c`.`access` IN (:preparedArray1,:preparedArray2) AND `c`.`published` = 1 AND `s`.`id` = :id
ORDER BY `c`.`lft`
```<hr /><sub>This comment was created with the <a href="https://github.com/joomla/jissues">J!Tracker Application</a> at <a href="https://issues.joomla.org/tracker/joomla-cms/46084">issues.joomla.org/tracker/joomla-cms/46084</a>.</sub>
avatar laoneo
laoneo - comment - 18 Sep 2025

Instead of modifying the existing one, I would create a new one. Like that you don't risk bc breaks.

Add a Comment

Login with GitHub to post a comment