Skip to content

IBX-10425: Translated string is returned as XML#29

Open
mateuszdebinski wants to merge 4 commits into4.6from
IBX-10425-return-XML-in-a-translated-string
Open

IBX-10425: Translated string is returned as XML#29
mateuszdebinski wants to merge 4 commits into4.6from
IBX-10425-return-XML-in-a-translated-string

Conversation

@mateuszdebinski
Copy link
Contributor

🎫 Issue IBX-10425

Description:

For QA:

Documentation:

@mateuszdebinski mateuszdebinski force-pushed the IBX-10425-return-XML-in-a-translated-string branch from 7945846 to d3ec14a Compare August 7, 2025 09:43
@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 7, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
62.2% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@mateuszdebinski mateuszdebinski force-pushed the IBX-10425-return-XML-in-a-translated-string branch from 57030ba to 0d8cd24 Compare November 24, 2025 14:16
@sonarqubecloud
Copy link

@mateuszdebinski mateuszdebinski marked this pull request as ready for review November 24, 2025 14:17
@mateuszdebinski mateuszdebinski requested a review from a team November 24, 2025 14:17
@mateuszdebinski mateuszdebinski added Bug Something isn't working Ready for review labels Nov 24, 2025
Copy link

@mikadamczyk mikadamczyk left a comment

Choose a reason for hiding this comment

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

You should add unit coverage for EncoderHelper::clearCDATAInTextField() to prove it strips CDATA on non‑RichText fields while preserving RichText, and an integration-style Encoder test that asserts the final XML contains plain text for regular fields and the placeholder tags for RichText. This guards the new logic and prevents regressions.

if (!$textNode instanceof DOMCdataSection) {
continue;
}
$parent = $textNode->parentNode;

Choose a reason for hiding this comment

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

$parent can be a non-element node, so calling getAttribute() may fatally error. You can check, like aboveif it isDOMElement`

@mikadamczyk mikadamczyk requested a review from a team December 16, 2025 15:41
Copy link
Contributor

@konradoboza konradoboza left a comment

Choose a reason for hiding this comment

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

The comments from Mikołaj are valid.

use Ibexa\FieldTypeRichText\FieldType\RichText\Value as RichTextValue;
use RuntimeException;

class EncoderHelper
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
class EncoderHelper
final class EncoderHelper

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

Labels

Bug Something isn't working Ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants