Fix a few memory management issues in DOMDocument

Summary: php_dom_create_object wasn't inserting the new object in the orphan
set if it already existed. This was causing certain objects obtained with
DOMNode::removeChild() to leak permanently.

DOMNode::replaceChild() wasn't removing the newly inserted element from its
orphan set, potentially causing a double-free during sweep. And it wasn't
inserting the old, unlinked element into the orphan set, causing that object to
leak.

Reviewed By: @paulbiss

Differential Revision: D1664798

Signature: t1:1664798:1415311959:80b81c412f82fad7e57a75c72ad17375c5654828