diff options
| author | Rob Richards <rrichards@php.net> | 2008-09-11 14:21:33 +0000 |
|---|---|---|
| committer | Rob Richards <rrichards@php.net> | 2008-09-11 14:21:33 +0000 |
| commit | dea7f49f70c108e3492c19fe0b3c9fdff1abb432 (patch) | |
| tree | 1e191d3d5ccee61f288101acfc5aa7f5543a4fc4 /ext/simplexml/simplexml.c | |
| parent | 94fd10cd79ce5c0e7710d2c02fe4497707bf6c31 (diff) | |
| download | php-git-dea7f49f70c108e3492c19fe0b3c9fdff1abb432.tar.gz | |
MFH: fix bug #46047 (SimpleXML converts empty nodes into object with nested array)
add test
Diffstat (limited to 'ext/simplexml/simplexml.c')
| -rw-r--r-- | ext/simplexml/simplexml.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index 546a9446e1..db52a79bb2 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1129,9 +1129,13 @@ static HashTable * sxe_get_prop_hash(zval *object, int is_debug TSRMLS_DC) /* {{ SKIP_TEXT(node); } else { if (node->type == XML_TEXT_NODE) { - MAKE_STD_ZVAL(value); - ZVAL_STRING(value, sxe_xmlNodeListGetString(node->doc, node, 1), 0); - zend_hash_next_index_insert(rv, &value, sizeof(zval *), NULL); + const xmlChar *cur = node->content; + + if (*cur != 0) { + MAKE_STD_ZVAL(value); + ZVAL_STRING(value, sxe_xmlNodeListGetString(node->doc, node, 1), 0); + zend_hash_next_index_insert(rv, &value, sizeof(zval *), NULL); + } goto next_iter; } } |
