From c5338e00d04c24adaee0c8bc104506f1569e1bf5 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Sat, 14 Mar 2015 20:16:41 +0000 Subject: [PATCH] Issue #2386903 by pfrenssen: Warning: DOMDocument::importNode() ID already defined --- core/modules/simpletest/src/WebTestBase.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/modules/simpletest/src/WebTestBase.php b/core/modules/simpletest/src/WebTestBase.php index 3d58756c4a4c..63cf76a9e67e 100644 --- a/core/modules/simpletest/src/WebTestBase.php +++ b/core/modules/simpletest/src/WebTestBase.php @@ -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. -- GitLab