Development

Changeset 9668

You must first sign up to be able to contribute.

Changeset 9668

Show
Ignore:
Timestamp:
06/19/08 15:22:32 (4 months ago)
Author:
fabien
Message:

fixed sfBrowser does not create DOMDocument when response is text/xml (closes #3766 - patch from francois)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/lib/util/sfBrowser.class.php

    r6129 r9668  
    201201 
    202202    // for HTML/XML content, create a DOM and sfDomCssSelector objects for the response content 
    203     if (preg_match('/(x|ht)ml/i', $response->getContentType())) 
     203    $content = $response->getContentType(); 
     204    if (preg_match('/(x|ht)ml/i', $content, $matches)) 
    204205    { 
    205206      $this->dom = new DomDocument('1.0', sfConfig::get('sf_charset')); 
    206207      $this->dom->validateOnParse = true; 
    207       @$this->dom->loadHTML($response->getContent()); 
     208      if ('x' == $matches[1]) 
     209      { 
     210        $this->dom->loadXML($content); 
     211      } 
     212      else 
     213      { 
     214        $this->dom->loadHTML($content); 
     215      } 
    208216      $this->domCssSelector = new sfDomCssSelector($this->dom); 
    209217    }