Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update HtmlFilter.php DOM Text Interpreted As HTML #879

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/code/Magento/PageBuilder/Model/Stage/HtmlFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function filterHtml(string $content): string
*/
private function getChildrenInnerHtml(\DOMElement $element): string
{
$innerHTML = '';
$innerText = '';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please elaborate on the purpose of this change.

Also as I can see here you are just changing the variable name. If that is so then please update the same in line number 115 and 118:

$innerHTML .= $ownerDocument->saveXML($child);

Copy link
Author

Choose a reason for hiding this comment

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

Hii @engcom-Hotel Thanks For Reviewing Yes done this changes

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also please help us with the purpose of this PR. In the actual codebase we are not using the innerHTML property, here $innerHTML is used as a variable. So this change doesn’t make any sense to me.

Please correct me if I am wrong.

$childrenIterator = $element->childNodes->getIterator();
while ($childrenIterator->valid()) {
$child = $childrenIterator->current();
Expand All @@ -112,9 +112,9 @@ private function getChildrenInnerHtml(\DOMElement $element): string
$childrenIterator->next();
continue;
}
$innerHTML .= $ownerDocument->saveXML($child);
$innerText .= $ownerDocument->saveXML($child);
$childrenIterator->next();
}
return $innerHTML;
return $innerText;
}
}