Skip to content

Commit a320547

Browse files
committed
Fix ValueError: DOMDocument::loadHTML(): Argument #1 ($source) must not be empty
1 parent 7a30760 commit a320547

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

lib/test/sfTesterResponse.class.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ public function initialize()
4949
}
5050
else
5151
{
52-
@$this->dom->loadHTML($this->response->getContent());
52+
if($this->response->getContent()) {
53+
@$this->dom->loadHTML($this->response->getContent());
54+
}
5355
}
5456
$this->domCssSelector = new sfDomCssSelector($this->dom);
5557
}
@@ -120,10 +122,10 @@ public function checkElement($selector, $value = true, $options = array())
120122

121123
/**
122124
* Checks that a form is rendered correctly.
123-
*
125+
*
124126
* @param sfForm|string $form A form object or the name of a form class
125127
* @param string $selector CSS selector for the root form element for this form
126-
*
128+
*
127129
* @return sfTestFunctionalBase|sfTester
128130
*/
129131
public function checkForm($form, $selector = 'form')
@@ -333,11 +335,11 @@ public function isHeader($key, $value)
333335

334336
/**
335337
* Tests if a cookie was set.
336-
*
338+
*
337339
* @param string $name
338340
* @param string $value
339341
* @param array $attributes Other cookie attributes to check (expires, path, domain, etc)
340-
*
342+
*
341343
* @return sfTestFunctionalBase|sfTester
342344
*/
343345
public function setsCookie($name, $value = null, $attributes = array())

lib/util/sfBrowserBase.class.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,9 @@ public function call($uri, $method = 'get', $parameters = array(), $changeStack
363363
}
364364
else
365365
{
366-
@$this->dom->loadHTML($response->getContent());
366+
if($response->getContent()) {
367+
@$this->dom->loadHTML($response->getContent());
368+
}
367369
}
368370
$this->domCssSelector = new sfDomCssSelector($this->dom);
369371
}

0 commit comments

Comments
 (0)