Fix PHP Notices in document.parser