mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #78221: DOMNode::normalize() doesn't remove empty text nodes
This commit is contained in:
commit
13c9572a79
3 changed files with 29 additions and 0 deletions
4
NEWS
4
NEWS
|
@ -3,6 +3,10 @@ PHP NEWS
|
||||||
|
|
||||||
?? ??? ????, PHP 7.4.6
|
?? ??? ????, PHP 7.4.6
|
||||||
|
|
||||||
|
- DOM:
|
||||||
|
. Fixed bug #78221 (DOMNode::normalize() doesn't remove empty text nodes).
|
||||||
|
(cmb)
|
||||||
|
|
||||||
- MBString:
|
- MBString:
|
||||||
. Fixed bug #79441 (Segfault in mb_chr() if internal encoding is unsupported).
|
. Fixed bug #79441 (Segfault in mb_chr() if internal encoding is unsupported).
|
||||||
(Girgias)
|
(Girgias)
|
||||||
|
|
|
@ -1385,6 +1385,14 @@ void dom_normalize (xmlNodePtr nodep)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
strContent = xmlNodeGetContent(child);
|
||||||
|
if (*strContent == '\0') {
|
||||||
|
nextp = child->next;
|
||||||
|
xmlUnlinkNode(child);
|
||||||
|
php_libxml_node_free_resource(child);
|
||||||
|
child = nextp;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case XML_ELEMENT_NODE:
|
case XML_ELEMENT_NODE:
|
||||||
dom_normalize (child);
|
dom_normalize (child);
|
||||||
|
|
17
ext/dom/tests/bug78221.phpt
Normal file
17
ext/dom/tests/bug78221.phpt
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #78221 (DOMNode::normalize() doesn't remove empty text nodes)
|
||||||
|
--SKIPIF--
|
||||||
|
<?php
|
||||||
|
if (!extension_loaded('dom')) die('skip dom extension not available');
|
||||||
|
?>
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
$doc = new DOMDocument();
|
||||||
|
$doc->loadHTML('<p id=x>foo</p>');
|
||||||
|
$p = $doc->getElementById('x');
|
||||||
|
$p->childNodes[0]->textContent = '';
|
||||||
|
$p->normalize();
|
||||||
|
var_dump($p->childNodes->length);
|
||||||
|
?>
|
||||||
|
--EXPECT--
|
||||||
|
int(0)
|
Loading…
Add table
Add a link
Reference in a new issue