Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ext/libxml/libxml.c
Original file line number Diff line number Diff line change
Expand Up @@ -1501,6 +1501,7 @@ PHP_LIBXML_API void php_libxml_node_decrement_resource(php_libxml_node_object *o
obj_node->_private = NULL;
}
}
object->node = NULL;
}
if (object != NULL && object->document != NULL) {
/* Safe to call as if the resource were freed then doc pointer is NULL */
Expand Down
19 changes: 19 additions & 0 deletions ext/simplexml/tests/reconstruct_with_retained_child.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
SimpleXMLElement reconstruction with a retained child
--EXTENSIONS--
simplexml
--FILE--
<?php
$xml = simplexml_load_string('<root><child>old</child></root>');
$child = $xml->child;

$xml->__construct('<root><new>new</new></root>');

var_dump((string) $xml->new);
var_dump((string) $child);
var_dump($child->asXML());
?>
--EXPECT--
string(3) "new"
string(3) "old"
string(18) "<child>old</child>"
Loading