Commit:    fc3f8a8f54d8b3c864125bf32028d4550882839c
Author:    Michael Wallner <m...@php.net>         Thu, 3 Oct 2013 13:28:41 +0200
Parents:   9209c19f8f7eef807cb457b32d3ab517ff8dc178
Branches:  PHP-5.4 PHP-5.5 master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=fc3f8a8f54d8b3c864125bf32028d4550882839c

Log:
fix bug #59613 (Crash with clone XMLReader)

Bugs:
https://bugs.php.net/59613

Changed paths:
  M  NEWS
  M  ext/xmlreader/php_xmlreader.c
  A  ext/xmlreader/tests/bug51963.phpt


Diff:
diff --git a/NEWS b/NEWS
index c2086c07..c6961bd 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,10 @@ PHP                                                            
            NEWS
   . Fixed bug #65808 (the socket_connect() won't work with IPv6 address).
     (Mike)
 
+- XMLReader:
+  . Fixed bug #59613 (Crash with clone XMLReader). (Mike)
+
+
 ?? ??? 2013, PHP 5.4.21
 
 - Core:
diff --git a/ext/xmlreader/php_xmlreader.c b/ext/xmlreader/php_xmlreader.c
index f4c2643..8b80320 100644
--- a/ext/xmlreader/php_xmlreader.c
+++ b/ext/xmlreader/php_xmlreader.c
@@ -1320,6 +1320,7 @@ PHP_MINIT_FUNCTION(xmlreader)
        xmlreader_object_handlers.read_property = xmlreader_read_property;
        xmlreader_object_handlers.write_property = xmlreader_write_property;
        xmlreader_object_handlers.get_property_ptr_ptr = 
xmlreader_get_property_ptr_ptr;
+       xmlreader_object_handlers.clone_obj = NULL;
 
        INIT_CLASS_ENTRY(ce, "XMLReader", xmlreader_functions);
        ce.create_object = xmlreader_objects_new;
diff --git a/ext/xmlreader/tests/bug51963.phpt 
b/ext/xmlreader/tests/bug51963.phpt
new file mode 100644
index 0000000..af47f97
--- /dev/null
+++ b/ext/xmlreader/tests/bug51963.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #59613 (Crash with clone XMLReader)
+--SKIPIF--
+<?php
+extension_loaded("xmlreader") or die("skip requires xmlreader");
+?>
+--FILE--
+<?php
+echo "Test\n";
+
+$xmlreader = new XMLReader();
+$xmlreader->xml("<a><b/></a>");
+
+$xmlreader->next();
+$xmlreader2 = clone $xmlreader;
+$xmlreader2->next();
+?>
+Done
+--EXPECTF--
+Test
+
+Fatal error: Trying to clone an uncloneable object of class XMLReader in %s on 
line %d


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to