Fix. Contacts Encoder. Shortcodes. Content sanitization improved.#794
Open
alexandergull wants to merge 2 commits intofixfrom
Open
Fix. Contacts Encoder. Shortcodes. Content sanitization improved.#794alexandergull wants to merge 2 commits intofixfrom
alexandergull wants to merge 2 commits intofixfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fix #794 +/- ##
============================================
+ Coverage 15.16% 15.25% +0.08%
- Complexity 5593 5602 +9
============================================
Files 264 264
Lines 27331 27357 +26
============================================
+ Hits 4146 4173 +27
+ Misses 23185 23184 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Contacts Encoder shortcode handling to avoid extracting/rewriting [apbct_encode_data]...[/apbct_encode_data] when it appears inside HTML tag/attribute contexts, and adds additional sanitization and test coverage around shortcode extraction behavior.
Changes:
- Added HTML-tag context detection (
isShortcodeInsideHtmlTag()/isOffsetInsideHtmlTag()) and an early-return guard inchangeContentBeforeEncoderModify(). - Sanitized extracted shortcode inner content via
Escape::escKsesPost()before storing/restoring. - Expanded PHPUnit coverage for shortcode extraction behavior, including attribute-context cases and offset detection.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
lib/Cleantalk/ApbctWP/ContactsEncoder/Shortcodes/EncodeContentSC.php |
Adds HTML-tag context detection, early-return guard, and sanitization during shortcode extraction. |
tests/ApbctWP/ContactsEncoder/TestContactsEncoderShortCodeEncode.php |
Adds tests for attribute-context non-processing, multiple shortcodes, and offset detection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
https://app.doboard.com/1/task/49054