From 6539970db4123c1202538aa6149bf9a9e94efe66 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sun, 21 Nov 2010 10:17:33 +0000 Subject: #933856 by Damien Tournoud: Fixed xpath() return values are inconsistent, leading to failing tests on some environments. --- modules/simpletest/drupal_web_test_case.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'modules/simpletest/drupal_web_test_case.php') 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; -- cgit v1.2.3