Skip to content

Fix Rector SimplifyQuoteEscapeRector failure in category URL rewrite joins - #5681

Open
addison74 with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-failing-github-actions-job
Open

Fix Rector SimplifyQuoteEscapeRector failure in category URL rewrite joins#5681
addison74 with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-failing-github-actions-job

Conversation

Copilot AI commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

PR #5663 introduced CONCAT('category/', entity_id) equality joins as a performance improvement over LIKE 'category/%' prefix matching, but used escaped single quotes in PHP single-quoted strings, which Rector's SimplifyQuoteEscapeRector rule rejects.

Changes

  • Mage/Catalog/Helper/Category/Url/Rewrite.php: Apply the LIKE → CONCAT equality change across all three join methods using double-quoted strings:

    • joinTableToEavCollection: LIKE 'category/%'= CONCAT('category/', e.entity_id)
    • joinTableToCollection: quoteInto(…LIKE…) → inline CONCAT expression
    • joinTableToSelect: prepareSqlCondition(…like…) → inline CONCAT expression
  • Mage/Core/Model/Resource/Url/Rewrite/Collection.php: Add category_id IS NOT NULL and id_path = CONCAT('category/', category_id) conditions to filterAllByCategory() alongside the existing LIKE filter.

Before (Rector failure):

. ' AND url_rewrite.id_path = CONCAT(\'category/\', main_table.entity_id)',

After (Rector passes):

. " AND url_rewrite.id_path = CONCAT('category/', main_table.entity_id)",

…L rewrite CONCAT expressions

Apply PR #5663 changes with proper quoting - replace LIKE 'category/%' with
= CONCAT('category/', entity_id) for more precise category URL rewrite joins.

Use double-quoted strings (not escaped single quotes) to satisfy Rector's
SimplifyQuoteEscapeRector rule which was flagging the CI job failure.
Copilot AI changed the title [WIP] Fix failing GitHub Actions job 'Rector / Rector' Fix Rector SimplifyQuoteEscapeRector failure in category URL rewrite joins Jul 11, 2026
Copilot AI requested a review from addison74 July 11, 2026 23:13
@sonarqubecloud

Copy link
Copy Markdown

@github-actions github-actions Bot added Component: Core Relates to Mage_Core Component: Catalog Relates to Mage_Catalog labels Jul 12, 2026
@github-actions

github-actions Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Test Results

    1 files  ±0  3 446 suites  ±0   18s ⏱️ ±0s
1 181 tests ±0  1 167 ✅ ±0     14 💤 ±0  0 ❌ ±0 
4 380 runs  ±0  1 194 ✅ ±0  3 186 💤 ±0  0 ❌ ±0 

Results for commit 8497721. ± Comparison against base commit cdeb7ee.

♻️ This comment has been updated with latest results.

@addison74
addison74 marked this pull request as ready for review July 12, 2026 20:57
Copilot AI review requested due to automatic review settings July 12, 2026 20:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a Rector SimplifyQuoteEscapeRector failure introduced by PR #5663 by rewriting SQL join predicates to avoid escaped single quotes inside PHP single-quoted strings, while keeping the intended performance optimization (canonical id_path equality via CONCAT('category/', …)).

Changes:

  • Update category URL rewrite join predicates to use id_path = CONCAT('category/', <category_id>) expressed in double-quoted PHP strings (avoids escaped quotes and keeps the equality-join optimization).
  • Tighten Mage_Core_Model_Resource_Url_Rewrite_Collection::filterAllByCategory() with additional conditions ensuring category_id is present and id_path matches the canonical category format.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
app/code/core/Mage/Catalog/Helper/Category/Url/Rewrite.php Rewrites the three category URL rewrite join conditions to use CONCAT('category/', …) equality via double-quoted SQL fragments (Rector-friendly).
app/code/core/Mage/Core/Model/Resource/Url/Rewrite/Collection.php Adds category_id IS NOT NULL and canonical id_path = CONCAT('category/', category_id) constraints to category URL rewrite filtering.

@loekvangool

Copy link
Copy Markdown
Contributor

Edits were transferred to the upstream PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Catalog Relates to Mage_Catalog Component: Core Relates to Mage_Core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants