Temporary fix for PHP XML bug 81506
The bug in PHP's XML implementation deallocates the Text node from memory, even though it might be referenced later. This patch release includes a number of hacky fixes to resolve this downstream, which is a good solution before the PHP bug is fixed.