Open
Fix Rector SimplifyQuoteEscapeRector failure in category URL rewrite joins#5681
Conversation
…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
|
Contributor
Hanmac
approved these changes
Jul 12, 2026
addison74
approved these changes
Jul 12, 2026
Contributor
There was a problem hiding this comment.
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 ensuringcategory_idis present andid_pathmatches 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. |
Contributor
|
Edits were transferred to the upstream PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



PR #5663 introduced
CONCAT('category/', entity_id)equality joins as a performance improvement overLIKE 'category/%'prefix matching, but used escaped single quotes in PHP single-quoted strings, which Rector'sSimplifyQuoteEscapeRectorrule rejects.Changes
Mage/Catalog/Helper/Category/Url/Rewrite.php: Apply theLIKE → CONCAT equalitychange across all three join methods using double-quoted strings:joinTableToEavCollection:LIKE 'category/%'→= CONCAT('category/', e.entity_id)joinTableToCollection:quoteInto(…LIKE…)→ inlineCONCATexpressionjoinTableToSelect:prepareSqlCondition(…like…)→ inlineCONCATexpressionMage/Core/Model/Resource/Url/Rewrite/Collection.php: Addcategory_id IS NOT NULLandid_path = CONCAT('category/', category_id)conditions tofilterAllByCategory()alongside the existingLIKEfilter.Before (Rector failure):
After (Rector passes):