#951774: DOMDocument::loadHTML() should not be called statically.

From: Damien Tournoud <damien@commerceguys.com>


---
 filter/filter.module                |    3 ++-
 simpletest/drupal_web_test_case.php |    6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git modules/filter/filter.module modules/filter/filter.module
index a19acb6..058912e 100644
--- modules/filter/filter.module
+++ modules/filter/filter.module
@@ -1046,8 +1046,9 @@ function _filter_tips($format_id, $long = FALSE) {
  *   A DOMDocument that represents the loaded (X)HTML snippet.
  */
 function filter_dom_load($text) {
+  $dom_document = new DOMDocument();
   // Ignore warnings during HTML soup loading.
-  $dom_document = @DOMDocument::loadHTML('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body>' . $text . '</body></html>');
+  @$dom_document->loadHTML('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body>' . $text . '</body></html>');
 
   return $dom_document;
 }
diff --git modules/simpletest/drupal_web_test_case.php modules/simpletest/drupal_web_test_case.php
index 95736fe..ead1d75 100644
--- modules/simpletest/drupal_web_test_case.php
+++ modules/simpletest/drupal_web_test_case.php
@@ -1585,7 +1585,8 @@ class DrupalWebTestCase extends DrupalTestCase {
     if (!$this->elements) {
       // DOM can load HTML soup. But, HTML soup can throw warnings, suppress
       // them.
-      @$htmlDom = DOMDocument::loadHTML($this->drupalGetContent());
+      $htmlDom = new DOMDocument();
+      @$htmlDom->loadHTML($this->drupalGetContent());
       if ($htmlDom) {
         $this->pass(t('Valid HTML found on "@path"', array('@path' => $this->getUrl())), t('Browser'));
         // It's much easier to work with simplexml than DOM, luckily enough
@@ -1857,7 +1858,8 @@ class DrupalWebTestCase extends DrupalTestCase {
       );
       // DOM can load HTML soup. But, HTML soup can throw warnings, suppress
       // them.
-      @$dom = DOMDocument::loadHTML($content);
+      $dom = new DOMDocument();
+      @$dom->loadHTML($content);
       foreach ($return as $command) {
         switch ($command['command']) {
           case 'settings':
