summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Watkins <krakjoe@php.net>2019-10-02 08:17:22 +0200
committerJoe Watkins <krakjoe@php.net>2019-10-02 08:17:45 +0200
commit32b87f855edafdcd5486d2b6c8b0703b343d77ed (patch)
tree27956ea26fff87f1c2617f01b5e48a13937fadeb
parente7e8e45166e87ad734fb02d85867327a7e2096f9 (diff)
parent6462c196897b8c5ccf606b8af8de790b77799de6 (diff)
downloadphp-git-32b87f855edafdcd5486d2b6c8b0703b343d77ed.tar.gz
Merge branch 'PHP-7.4'
* PHP-7.4: Fixed #75245 Don't set content of elements with only whitespaces
-rw-r--r--NEWS6
-rw-r--r--ext/simplexml/simplexml.c2
-rw-r--r--ext/simplexml/tests/bug39662.phpt12
-rw-r--r--ext/simplexml/tests/bug75245.phpt21
4 files changed, 29 insertions, 12 deletions
diff --git a/NEWS b/NEWS
index 050f9e93d7..ddb536a4bb 100644
--- a/NEWS
+++ b/NEWS
@@ -45,7 +45,11 @@ PHP NEWS
. Fixed bug #77800 (phpdbg segfaults on listing some conditional breakpoints).
(krakjoe)
. Fixed bug #77805 (phpdbg build fails when readline is shared). (krakjoe)
-
+
+- SimpleXML:
+ . Fixed bug #75245 (Don't set content of elements with only whitespaces).
+ (eriklundin)
+
- sodium:
. Fixed bug #77646 (sign_detached() strings not terminated). (Frank)
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 22ea26ca38..0950c3365d 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -1206,7 +1206,7 @@ static HashTable *sxe_get_prop_hash(zend_object *object, int is_debug) /* {{{ */
}
while (node) {
- if (node->children != NULL || node->prev != NULL || node->next != NULL) {
+ if (node->children != NULL || node->prev != NULL || node->next != NULL || xmlIsBlankNode(node)) {
SKIP_TEXT(node);
} else {
if (node->type == XML_TEXT_NODE) {
diff --git a/ext/simplexml/tests/bug39662.phpt b/ext/simplexml/tests/bug39662.phpt
index b07e90064f..5dc2b99a92 100644
--- a/ext/simplexml/tests/bug39662.phpt
+++ b/ext/simplexml/tests/bug39662.phpt
@@ -19,17 +19,9 @@ var_dump($clone->asXML());
echo "Done\n";
?>
--EXPECTF--
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(2) "
-
-"
+object(SimpleXMLElement)#%d (0) {
}
-object(SimpleXMLElement)#%d (1) {
- [0]=>
- string(2) "
-
-"
+object(SimpleXMLElement)#%d (0) {
}
string(15) "<test>
diff --git a/ext/simplexml/tests/bug75245.phpt b/ext/simplexml/tests/bug75245.phpt
new file mode 100644
index 0000000000..4a7a7caf0b
--- /dev/null
+++ b/ext/simplexml/tests/bug75245.phpt
@@ -0,0 +1,21 @@
+--TEST--
+Bug #75245 Don't set content of elements with only whitespaces
+--SKIPIF--
+<?php
+if (!extension_loaded('simplexml')) die('skip simplexml not available');
+?>
+--FILE--
+<?php
+var_dump(simplexml_load_string('<test1><test2> </test2><test3></test3></test1>'));
+?>
+===DONE===
+--EXPECT--
+object(SimpleXMLElement)#1 (2) {
+ ["test2"]=>
+ object(SimpleXMLElement)#2 (0) {
+ }
+ ["test3"]=>
+ object(SimpleXMLElement)#3 (0) {
+ }
+}
+===DONE===