tony2001 Tue Feb 20 14:08:43 2007 UTC Added files: (Branch: PHP_5_2) /php-src/ext/simplexml/tests bug38406.phpt
Modified files: /php-src/ext/simplexml simplexml.c Log: MFH: fix leak and errmsg add test http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/simplexml.c?r1=1.151.2.22.2.22&r2=1.151.2.22.2.23&diff_format=u Index: php-src/ext/simplexml/simplexml.c diff -u php-src/ext/simplexml/simplexml.c:1.151.2.22.2.22 php-src/ext/simplexml/simplexml.c:1.151.2.22.2.23 --- php-src/ext/simplexml/simplexml.c:1.151.2.22.2.22 Tue Feb 20 13:22:41 2007 +++ php-src/ext/simplexml/simplexml.c Tue Feb 20 14:08:43 2007 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: simplexml.c,v 1.151.2.22.2.22 2007/02/20 13:22:41 tony2001 Exp $ */ +/* $Id: simplexml.c,v 1.151.2.22.2.23 2007/02/20 14:08:43 tony2001 Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -515,7 +515,10 @@ } /* break is missing intentionally */ default: - php_error_docref(NULL TSRMLS_CC, E_WARNING, "It is not yet possible to assign complex types to %s", attribs ? "attributes" : "properties"); + if (member == &tmp_zv) { + zval_dtor(&tmp_zv); + } + zend_error(E_WARNING, "It is not yet possible to assign complex types to %s", attribs ? "attributes" : "properties"); return; } } @@ -2356,7 +2359,7 @@ { php_info_print_table_start(); php_info_print_table_header(2, "Simplexml support", "enabled"); - php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.22.2.22 $"); + php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.22.2.23 $"); php_info_print_table_row(2, "Schema support", #ifdef LIBXML_SCHEMAS_ENABLED "enabled"); http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/tests/bug38406.phpt?view=markup&rev=1.1 Index: php-src/ext/simplexml/tests/bug38406.phpt +++ php-src/ext/simplexml/tests/bug38406.phpt --TEST-- Bug #38406 (crash when assigning objects to SimpleXML attributes) --SKIPIF-- <?php if (!extension_loaded("simplexml")) print "skip"; ?> --FILE-- <?php $item = new SimpleXMLElement(b'<something />'); $item->attribute = b'something'; var_dump($item->attribute); $item->otherAttribute = $item->attribute; var_dump($item->otherAttribute); $a = array(); $item->$a = new stdclass; echo "Done\n"; ?> --EXPECTF-- object(SimpleXMLElement)#%d (1) { [0]=> string(9) "something" } object(SimpleXMLElement)#%d (1) { [0]=> string(9) "something" } Notice: Array to string conversion in %s on line %d Warning: It is not yet possible to assign complex types to properties in %s on line %d Done --UEXPECTF-- object(SimpleXMLElement)#%d (1) { [0]=> unicode(9) "something" } object(SimpleXMLElement)#%d (1) { [0]=> unicode(9) "something" } Notice: Array to string conversion in %s on line %d Warning: It is not yet possible to assign complex types to properties in %s on line %d Done -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php