summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSterling Hughes <sterling@php.net>2003-06-25 16:26:32 +0000
committerSterling Hughes <sterling@php.net>2003-06-25 16:26:32 +0000
commita4f41fbb26c3e381adcb8f556618ce233b2bfd0a (patch)
tree9fa7950b16f4d51230fdcda804a44dc7b6cf9520
parent1aa6e3fee3d7e6832923e391f006eb37028acbb8 (diff)
downloadphp-git-a4f41fbb26c3e381adcb8f556618ce233b2bfd0a.tar.gz
allow the root element to be accessed as a text node
-rw-r--r--ext/simplexml/simplexml.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 3cee43d969..19db746844 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -738,12 +738,18 @@ sxe_object_cast(zval *readobj, zval *writeobj, int type, int should_free TSRMLS_
zval_dtor(writeobj);
}
+ if (!sxe->node) {
+ if (sxe->document) {
+ sxe->node = xmlDocGetRootElement((xmlDocPtr) sxe->document->ptr);
+ }
+ }
+
if (sxe->node) {
contents = xmlNodeListGetString((xmlDocPtr) sxe->document->ptr, sxe->node->children, 1);
if (!xmlIsBlankNode(sxe->node->children) && contents) {
cast_object(writeobj, type, NULL TSRMLS_CC);
}
- }
+ }
cast_object(writeobj, type, contents TSRMLS_CC);