Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## fix #863 +/- ##
============================================
+ Coverage 29.36% 29.52% +0.16%
- Complexity 6467 6493 +26
============================================
Files 288 289 +1
Lines 26126 26199 +73
============================================
+ Hits 7672 7736 +64
- Misses 18454 18463 +9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates the Contacts Encoder buffer-mode shortcode handling to avoid processing/“absorbing” content inside rendered WordPress comment lists, and adds PHPUnit coverage for the new behavior.
Changes:
- Added
CEIntegrationCommentListto protect/restore rendered comment list regions during buffer-mode processing. - Integrated the new comment-list protection into
ShortCodesService::modifyBufferBefore()/modifyBufferAfter(). - Added/extended tests to validate comment list preservation and buffer-mode behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
lib/Cleantalk/ApbctWP/ContactsEncoder/Shortcodes/ShortCodesService.php |
Wraps buffer processing with comment-list protect/restore to prevent unintended shortcode handling inside comments. |
lib/Cleantalk/ApbctWP/ContactsEncoder/Integrations/CEIntegrationCommentList.php |
New integration that replaces detected comment-list HTML regions with placeholders and later restores them. |
tests/ApbctWP/ContactsEncoder/TestContactsEncoderShortCodeEncode.php |
Adds a buffer-mode regression test ensuring comment text and encode_data tags aren’t incorrectly processed. |
tests/ApbctWP/ContactsEncoder/Integrations/TestCEIntegrationCommentList.php |
Adds unit tests for protect/restore correctness and no-op behavior when no comment list is present. |
Suppressed comments (1)
lib/Cleantalk/ApbctWP/ContactsEncoder/Integrations/CEIntegrationCommentList.php:52
restore()keeps$region_placeholderspopulated after it runs, which retains the full protected comment HTML in memory and keeps state around for subsequent calls. Clear the placeholders after applyingstrtr()(similar toCEIntegrationGridBuilder::restoreRegions()which resets its placeholders).
public function restore($content)
{
if ( ! is_string($content) || $this->region_placeholders === array() ) {
return $content;
}
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
lib/Cleantalk/ApbctWP/ContactsEncoder/Integrations/CEIntegrationCommentList.php:24
CEIntegrationCommentListkeeps state in$region_placeholders. Inprotect(), the placeholders are only reset after the early substring checks; if the same instance previously protected content and laterprotect()returns early (no comment markers), a subsequentrestore()can still apply stale placeholder replacements to unrelated content. Reset placeholders at the start ofprotect()(before any early returns).
public function protect($content)
{
if ( ! is_string($content) || $content === '' ) {
return $content;
}
task https://app.doboard.com/1/task/55162