fix bug #41867 (getName is broken)

add test
This commit is contained in:
Rob Richards 2007-07-02 11:35:18 +00:00
parent 320a41603e
commit 4938221a36
2 changed files with 21 additions and 3 deletions

View File

@ -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();
}
}
/* }}} */

View File

@ -0,0 +1,14 @@
--TEST--
Bug #41867 (getName is broken)
--FILE--
<?php
$a = simplexml_load_string("<a><b><c/></b></a>");
echo $a->getName()."\n";
echo $a->b->getName()."\n";
echo $a->b->c->getName();
?>
--EXPECT--
a
b
c