Commit c5338e00 authored by alexpott's avatar alexpott
Browse files

Issue #2386903 by pfrenssen: Warning: DOMDocument::importNode() ID already defined

parent be30a526
......@@ -1899,8 +1899,12 @@ protected function drupalProcessAjaxResponse($content, array $ajax_response, arr
if ($wrapperNode) {
// ajax.js adds an enclosing DIV to work around a Safari bug.
$newDom = new \DOMDocument();
// DOM can load HTML soup. But, HTML soup can throw warnings,
// suppress them.
@$newDom->loadHTML('<div>' . $command['data'] . '</div>');
$newNode = $dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE);
// Suppress warnings thrown when duplicate HTML IDs are encountered.
// This probably means we are replacing an element with the same ID.
$newNode = @$dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE);
$method = isset($command['method']) ? $command['method'] : $ajax_settings['method'];
// The "method" is a jQuery DOM manipulation function. Emulate
// each one using PHP's DOMNode API.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment