ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> php-cvs
php-cvs
[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/simplexml simplexml.c /ext/simplexml/tests bug39662.phpt
by Antony Dovgal other posts by this author
Nov 28 2006 11:00AM messages near this date
[PHP-CVS] cvs: php-src /ext/spl/examples callbackfilteriterator.inc | [PHP-CVS] cvs: php-src /ext/simplexml simplexml.c /ext/simplexml/tests bug39662.phpt
tony2001		Tue Nov 28 18:59:53 2006 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/simplexml/tests	bug39662.phpt 

  Modified files:              
    /php-src	NEWS 
    /php-src/ext/simplexml	simplexml.c 
  Log:
  MFH: fix #39662 (Segfault when calling asXML() of a cloned SimpleXMLElement)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.380&r2=1.2027.2.547.2.381&diff_
format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.380 php-src/NEWS:1.2027.2.547.2.381
--- php-src/NEWS:1.2027.2.547.2.380	Tue Nov 28 16:27:53 2006
+++ php-src/NEWS	Tue Nov 28 18:59:52 2006
@@ -43,6 +43,8 @@
     php_filter.h).
 - Fixed wrong signature initialization in imagepng (Takeshi Abe)
 - Added optimization for imageline with horizontal and vertial lines (Pierre)
+- Fixed bug #39662 (Segfault when calling asXML() of a cloned SimpleXMLElement).
+  (Tony)
 - Fixed bug #39656 (crash when calling fetch() on a PDO statment object
   after closeCursor()). (Ilia, Tony)
 - Fixed bug #39653 (ext/dba doesn't check for db-4.5 and db-4.4 when db4 
http://cvs.php.net/viewvc.cgi/php-src/ext/simplexml/simplexml.c?r1=1.151.2.22.2.15&r2=1.151.
2.22.2.16&diff_format=u
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.151.2.22.2.15 php-src/ext/simplexml/simplexml.c:
1.151.2.22.2.16
--- php-src/ext/simplexml/simplexml.c:1.151.2.22.2.15	Wed Sep  6 15:31:48 2006
+++ php-src/ext/simplexml/simplexml.c	Tue Nov 28 18:59:52 2006
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: simplexml.c,v 1.151.2.22.2.15 2006/09/06 15:31:48 nlopess Exp $ */
+/* $Id: simplexml.c,v 1.151.2.22.2.16 2006/11/28 18:59:52 tony2001 Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1762,6 +1762,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);
@@ -2331,7 +2332,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.15 $");
+	php_info_print_table_row(2, "Revision", "$Revision: 1.151.2.22.2.16 $");
 	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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved