forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #70001: Assigning to DOMNode::textContent does additional entity …
…encoding Assigning to DOMNode::textContent encodes entities, what does not match the behavior of DOMText::__construct() and DOMDocument::createTextNode. This patch changes the behavior of DOMNode::textContent in this regard.
- Loading branch information
Showing
2 changed files
with
20 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--TEST-- | ||
Bug #70001 (Assigning to DOMNode::textContent does additional entity encoding) | ||
--SKIPIF-- | ||
<?php require_once('skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
$element = new DOMText('<p>foo & bar</p>'); | ||
var_dump($element->textContent); | ||
$element = (new DOMDocument())->createTextNode('<p>foo & bar</p>'); | ||
var_dump($element->textContent); | ||
$element->textContent = ('<p>foo & bar</p>'); | ||
var_dump($element->textContent); | ||
?> | ||
--EXPECT-- | ||
string(16) "<p>foo & bar</p>" | ||
string(16) "<p>foo & bar</p>" | ||
string(16) "<p>foo & bar</p>" |