diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh
index 5da468ba7719b92f9acc31ce51e17411eee9605b..4dbd4fdd8b93bb8f4941348a91061a528b290182 100644
--- a/core/scripts/run-tests.sh
+++ b/core/scripts/run-tests.sh
@@ -967,7 +967,12 @@ function simpletest_script_reporter_write_xml_results() {
       // Create the XML element for this test case:
       $case = $dom_document->createElement('testcase');
       $case->setAttribute('classname', $test_class);
-      list($class, $name) = explode('->', $result->function, 2);
+      if (strpos($result->function, '->') !== FALSE) {
+        list($class, $name) = explode('->', $result->function, 2);
+      }
+      else {
+        $name = $result->function;
+      }
       $case->setAttribute('name', $name);
 
       // Passes get no further attention, but failures and exceptions get to add more detail: