diff options
| author | Rob Richards <rrichards@php.net> | 2007-07-02 11:35:18 +0000 |
|---|---|---|
| committer | Rob Richards <rrichards@php.net> | 2007-07-02 11:35:18 +0000 |
| commit | 4938221a36cb512b5d39330fdad28635f8622395 (patch) | |
| tree | cd90c11356776e2777294a902985f116aa555455 /ext/simplexml/simplexml.c | |
| parent | 320a41603e7fea7ffb952fd7636e0074a4d60729 (diff) | |
| download | php-git-4938221a36cb512b5d39330fdad28635f8622395.tar.gz | |
fix bug #41867 (getName is broken)
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 a62151d884..5c7cd60e5c 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -1488,9 +1488,13 @@ SXE_METHOD(getName) sxe = php_sxe_fetch_object(getThis() TSRMLS_CC); GET_NODE(sxe, node); - - namelen = xmlStrlen(node->name); - RETURN_STRINGL((char*)node->name, namelen, 1); + node = php_sxe_get_first_node(sxe, node TSRMLS_CC); + if (node) { + namelen = xmlStrlen(node->name); + RETURN_STRINGL((char*)node->name, namelen, 1); + } else { + RETURN_EMPTY_STRING(); + } } /* }}} */ |
