Test case code:
<?php
$str = file_get_contents('test string');
$dom = new DOMElement( 'test', $str );
var_dump( strlen($str) ); // Output int(10964)
var_dump( $dom->textContent ); // Output string(50) "O:33:"MWOps\MediaWiki\MediaWikiInstance":3:{s:46:""
The "test string" is here, the string is a serialized object. I lost tens of thousands of bytes of data at runtime. But I can't find the problem.