Development

#3766 ([PATCH] sfBrowser does not create DOMDocument when response is text/xml)

You must first sign up to be able to contribute.

Ticket #3766 (closed defect: fixed)

Opened 6 months ago

Last modified 6 months ago

[PATCH] sfBrowser does not create DOMDocument when response is text/xml

Reported by: francois Assigned to: fabien
Priority: minor Milestone: 1.0.17
Component: other Version: 1.0.16
Keywords: Cc:
Qualification: Unreviewed

Description

Line 300 of sfBrowser.php, symfony checks the content type before trying to construct a DOMDocument with the response:

    // for HTML/XML content, create a DOM and sfDomCssSelector objects for the response content
    if (preg_match('/(x|ht)ml/i', $response->getContentType()))
    {
      $this->dom = new DomDocument('1.0', sfConfig::get('sf_charset'));
      $this->dom->validateOnParse = true;
      @$this->dom->loadHTML($response->getContent());
      $this->domCssSelector = new sfDomCssSelector($this->dom);
    }
    else
    {
      $this->dom = null;
      $this->domCssSelector = null;
    }

The problem is that if my response is pure XML (with a text/xml content-type), then I will pass the first test but the loadHTML() method will probably fail (and without warning because of the @). In this case I should use loadXML() instead.

This is very problemetic if I want to build REST web services and validate them with sfTestBrowser.

Attachments

sfBrowser.patch (0.9 kB) - added by francois on 06/17/08 16:30:01.

Change History

06/17/08 16:30:01 changed by francois

  • attachment sfBrowser.patch added.

06/17/08 20:05:46 changed by dwhittle

I tweaked patch and committed to my branch in r9622.

06/19/08 15:22:32 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

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

06/19/08 15:22:48 changed by fabien

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

06/19/08 15:23:04 changed by fabien

  • milestone set to 1.0.17.