cvs: php-src /ext/simplexml simplexml.c /ext/simplexml/tests bug41867.phpt

From: Date: Mon, 02 Jul 2007 11:36:28 +0000
Subject: cvs: php-src /ext/simplexml simplexml.c /ext/simplexml/tests bug41867.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-45068@lists.php.net to get a copy of this message
rrichards Mon Jul 2 11:36:28 2007 UTC Modified files: /php-src/ext/simplexml simplexml.c /php-src/ext/simplexml/tests bug41867.phpt Log: MFB: fix bug #41867 (getName is broken) add test http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/simplexml.c?r1=1.236&r2=1.237&diff_format=u Index: php-src/ext/simplexml/simplexml.c diff -u php-src/ext/simplexml/simplexml.c:1.236 php-src/ext/simplexml/simplexml.c:1.237 --- php-src/ext/simplexml/simplexml.c:1.236 Fri Jun 29 13:58:34 2007 +++ php-src/ext/simplexml/simplexml.c Mon Jul 2 11:36:28 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: simplexml.c,v 1.236 2007/06/29 13:58:34 dmitry Exp $ */ +/* $Id: simplexml.c,v 1.237 2007/07/02 11:36:28 rrichards Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -1550,9 +1550,13 @@ sxe = php_sxe_fetch_object(getThis() TSRMLS_CC); GET_NODE(sxe, node); - - namelen = xmlStrlen(node->name); - RETVAL_XML_STRING_LEN((char *) node->name, namelen, ZSTR_DUPLICATE); + node = php_sxe_get_first_node(sxe, node TSRMLS_CC); + if (node) { + namelen = xmlStrlen(node->name); + RETVAL_XML_STRING_LEN((char *) node->name, namelen, ZSTR_DUPLICATE); + } else { + RETURN_EMPTY_TEXT(); + } } /* }}} */ @@ -2482,7 +2486,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "Simplexml support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.236 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.237 $"); php_info_print_table_row(2, "Schema support", #ifdef LIBXML_SCHEMAS_ENABLED "enabled"); http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/tests/bug41867.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/simplexml/tests/bug41867.phpt diff -u /dev/null php-src/ext/simplexml/tests/bug41867.phpt:1.2 --- /dev/null Mon Jul 2 11:36:28 2007 +++ php-src/ext/simplexml/tests/bug41867.phpt Mon Jul 2 11:36:28 2007 @@ -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

« previous php.cvs (#45068) next »