[PHP-CVS] cvs: php-src /ext/simplexml simplexml.c /ext/simplexml/tests bug39662.phpt
by Antony Dovgal other posts by this author
Nov 28 2006 10:58AM messages near this date
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/simplexml simplexml.c /ext/simplexml/tests bug39662.phpt
|
[PHP-CVS] cvs: php-src /ext/pdo/tests bug_39656.phpt
tony2001 Tue Nov 28 18:57:37 2006 UTC
Added files:
/php-src/ext/simplexml/tests bug39662.phpt
Modified files:
/php-src/ext/simplexml simplexml.c
Log:
fix #39662 (Segfault when calling asXML() of a cloned SimpleXMLElement)
http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/simplexml.c?r1=1.221&r2=1.222&diff_forma
t=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.221 php-src/ext/simplexml/simplexml.c:1.222
--- php-src/ext/simplexml/simplexml.c:1.221 Fri Oct 13 14:52:19 2006
+++ php-src/ext/simplexml/simplexml.c Tue Nov 28 18:57:37 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: simplexml.c,v 1.221 2006/10/13 14:52:19 andrei Exp $ */
+/* $Id: simplexml.c,v 1.222 2006/11/28 18:57:37 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -1784,6 +1784,7 @@
}
if (sxe-> node) {
nodep = xmlDocCopyNode(sxe-> node->node, docp, 1);
+ nodep-> parent = sxe->node->node->parent;
}
php_libxml_increment_node_ptr((php_libxml_node_object *)clone, nodep, NULL TSRMLS_CC);
@@ -2361,7 +2362,7 @@
{
php_info_print_table_start();
php_info_print_table_header(2, "Simplexml support", "enabled");
- php_info_print_table_row(2, "Revision", "$Revision: 1.221 $");
+ php_info_print_table_row(2, "Revision", "$Revision: 1.222 $");
php_info_print_table_row(2, "Schema support",
#ifdef LIBXML_SCHEMAS_ENABLED
"enabled");
http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/tests/bug39662.phpt?view=markup&rev=1.1
Index: php-src/ext/simplexml/tests/bug39662.phpt
+++ php-src/ext/simplexml/tests/bug39662.phpt
--TEST--
Bug #39662 (Segfault when calling asXML() of a cloned SimpleXMLElement)
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip simplexml extension is not loaded"; ?>
--FILE--
<?php
$xml = b'<?xml version="1.0" encoding="utf-8" ?>
<test>
</test> ';
$root = simplexml_load_string($xml);
$clone = clone $root;
var_dump($root);
var_dump($clone);
var_dump($clone-> asXML());
echo "Done\n";
?>
--EXPECTF--
object(SimpleXMLElement)#%d (1) {
[0]=>
string(2) "
"
}
object(SimpleXMLElement)#%d (1) {
[0]=>
string(2) "
"
}
string(55) "<?xml version="1.0" encoding="utf-8"?>
<test>
</test>
"
Done
--UEXPECTF--
object(SimpleXMLElement)#%d (1) {
[0]=>
unicode(2) "
"
}
object(SimpleXMLElement)#%d (1) {
[0]=>
unicode(2) "
"
}
string(55) "<?xml version="1.0" encoding="utf-8"?>
<test>
</test>
"
Done
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
|