diff options
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | ext/simplexml/simplexml.c | 2 | ||||
-rw-r--r-- | ext/simplexml/tests/bug39662.phpt | 12 | ||||
-rw-r--r-- | ext/simplexml/tests/bug75245.phpt | 21 |
4 files changed, 29 insertions, 12 deletions
@@ -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=== |