From f7459bad300fd20d6bd013676c842331f3f6e26b Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Sun, 23 Oct 2005 23:41:20 +0000 Subject: [PATCH] - Fix issue with entities in attributes --- ext/simplexml/simplexml.c | 9 ++++++++- ext/simplexml/tests/023.phpt | 6 ++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index c0d52144e7..980c33da50 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -701,7 +701,14 @@ sxe_properties_get(zval *object TSRMLS_DC) node = php_sxe_get_first_node(sxe, node TSRMLS_CC); if (node) { - node = node->children; + if (node->type == XML_ATTRIBUTE_NODE) { + MAKE_STD_ZVAL(value); + ZVAL_U_STRING(ZEND_U_CONVERTER(UG(runtime_encoding_conv)), value, xmlNodeListGetString(node->doc, node->children, 1), 1); + zend_hash_next_index_insert(rv, &value, sizeof(zval *), NULL); + node = NULL; + } else { + node = node->children; + } while (node) { if (node->children != NULL || node->prev != NULL || node->next != NULL) { diff --git a/ext/simplexml/tests/023.phpt b/ext/simplexml/tests/023.phpt index 1e919ae564..dd6dde59d7 100755 --- a/ext/simplexml/tests/023.phpt +++ b/ext/simplexml/tests/023.phpt @@ -22,11 +22,9 @@ var_dump($sxe['attr']); ?> ===DONE=== --EXPECTF-- -object(SimpleXMLElement)#1 (1) { - ["attr"]=> - string(%d) "foo%sbar%sbaz" +object(SimpleXMLElement)#%d (0) { } -object(SimpleXMLElement)#2 (1) { +object(SimpleXMLElement)#%d (1) { [0]=> string(%d) "foo%sbar%sbaz" } -- 2.40.0