|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-01-26 20:05 UTC] rrichards@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 10:00:01 2025 UTC |
Description: ------------ A call to DOMDocument::load() or ::loadXML() in recovery mode leads to segmentation fault in dom_document_parser) when the XML declaration contains an unknown (and unrecoverable) encoding. The segfault occurs in document.c +1690 when trying to access properties of the result document (ret), which is NULL in this case: if (ret->URL == NULL && ctxt->directory != NULL) { Reproduce code: --------------- <?php $xml = '<?xml version="1.0" encoding="bad"?>'; $dom = new DOMDocument; $dom->recover = true; $dom->loadXML($xml); echo $dom->saveXML(); Expected result: ---------------- <?xml version="1.0"?> Actual result: -------------- Segmentation Fault