Fix 362#520
Open
sorinmarta wants to merge 2 commits into
Open
Conversation
Prevents admin editor attribute breakout from malicious captions.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@includes/fields/class-fieldtypes-image.php`:
- Line 88: Update the caption assignment near $caption so it uses null
coalescing rather than empty(), preserving the valid string "0" produced by
convert_input(). Continue defaulting to an empty string only when $value[1] is
null or unset.
- Around line 482-485: Update convert_input() to safely handle partial or
malformed image arrays by using null-coalescing defaults for offsets 0 and 1,
and ensure both image and caption values are scalar or safely cast before
passing them to absint() and sanitize_text_field(). Preserve the existing
empty-string outputs for missing or invalid values.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 58cdf4b5-40cb-4579-aa92-3c4a566ef688
📒 Files selected for processing (1)
includes/fields/class-fieldtypes-image.php
Preserve caption "0" and safely handle partial or malformed arrays.
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.
fixes https://github.com/Strategy11/business-directory-premium/issues/362