summaryrefslogtreecommitdiff
path: root/modules/simpletest
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-11-21 10:17:33 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-11-21 10:17:33 +0000
commit6539970db4123c1202538aa6149bf9a9e94efe66 (patch)
tree1bbe44e0f76e99c37fbd3d68715dc96db94ce1b8 /modules/simpletest
parentfc8be9eeb4a8fbe872da57b8e270966a1ba45eae (diff)
downloadbrdo-6539970db4123c1202538aa6149bf9a9e94efe66.tar.gz
brdo-6539970db4123c1202538aa6149bf9a9e94efe66.tar.bz2
#933856 by Damien Tournoud: Fixed xpath() return values are inconsistent, leading to failing tests on some environments.
Diffstat (limited to 'modules/simpletest')
-rw-r--r--modules/simpletest/drupal_web_test_case.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index ecdff06ff..1949b99a5 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -2188,7 +2188,11 @@ class DrupalWebTestCase extends DrupalTestCase {
protected function xpath($xpath, array $arguments = array()) {
if ($this->parse()) {
$xpath = $this->buildXPathQuery($xpath, $arguments);
- return $this->elements->xpath($xpath);
+ $result = $this->elements->xpath($xpath);
+ // Some combinations of PHP / libxml versions return an empty array
+ // instead of the documented FALSE. Forcefully convert any falsish values
+ // to an empty array to allow foreach(...) constructions.
+ return $result ? $result : array();
}
else {
return FALSE;