Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.916
diff -u -r1.916 common.inc
--- includes/common.inc	2 Jun 2009 06:58:15 -0000	1.916
+++ includes/common.inc	8 Jun 2009 06:46:12 -0000
@@ -4391,6 +4391,7 @@
  */
 function drupal_parse_info_file($filename) {
   $info = array();
+  $constants = get_defined_constants();
 
   if (!file_exists($filename)) {
     return $info;
@@ -4434,8 +4435,8 @@
         $parent = &$parent[$key];
       }
 
-      // Handle PHP constants
-      if (defined($value)) {
+      // Handle PHP constants.
+      if (isset($constants[$value])) {
         $value = constant($value);
       }
 
Index: modules/simpletest/tests/common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.44
diff -u -r1.44 common.test
--- modules/simpletest/tests/common.test	2 Jun 2009 03:33:36 -0000	1.44
+++ modules/simpletest/tests/common.test	8 Jun 2009 06:46:13 -0000
@@ -786,7 +786,6 @@
  * Tests Simpletest error and exception collecter.
  */
 class DrupalErrorCollectionUnitTest extends DrupalWebTestCase {
-
   /**
    * Errors triggered during the test.
    *
@@ -853,3 +852,34 @@
   }
 }
 
+/**
+ * Test the drupal_parse_info_file() API function.
+ */
+class ParseInfoFilesTestCase extends DrupalWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => t('Parsing .info files'),
+      'description' => t('Tests parsing .info files.'),
+      'group' => t('System'),
+    );
+  }
+
+  function setUp() {
+    parent::setUp('common_test');
+  }
+
+  /**
+   * Parse an example .info file an verify the results.
+   */
+  function testParseInfoFile() {
+    $this->drupalGet('common-test/drupal-parse-info-file');
+
+    // Verify that parsing did not choke on the double-colon.
+    $this->assertNoText('PHP Fatal error', t('No fatal errors were generated while parsing the .info file.'), t('System'));
+    $this->assertNoText("Class 'dummyClassName' not found", t('No errors were generated for the value containing the double-colon.'), t('System'));
+
+    $this->assertRaw("'simple_string' => 'A simple string'", t('Simple string value was parsed correctly.'), t('System'));
+    $this->assertRaw("'simple_constant' => " . WATCHDOG_INFO, t('Constant value was parsed correctly.'), t('System'));
+    $this->assertRaw("'double_colon' => 'dummyClassName::'", t('Value containing double-colon was parsed correctly.'), t('System'));
+  }
+}
\ No newline at end of file
Index: modules/simpletest/tests/common_test.info
===================================================================
RCS file: modules/simpletest/tests/common_test.info
diff -N modules/simpletest/tests/common_test.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/common_test.info	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,8 @@
+; $Id$
+name = Common test
+description = Support module for common.inc testing.
+package = Testing
+version = VERSION
+core = 7.x
+files[] = common_test.module
+hidden = TRUE
Index: modules/simpletest/tests/common_test_info.txt
===================================================================
RCS file: modules/simpletest/tests/common_test_info.txt
diff -N modules/simpletest/tests/common_test_info.txt
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/common_test_info.txt	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,10 @@
+; $Id$
+; Test parsing with a simple string.
+simple_string = A simple string
+
+; Test that constants can be used as values. 
+simple_constant = WATCHDOG_INFO
+
+; After parsing the .info file, 'double_colon' should hold the literal value.
+; Parsing should not throw a fatal error or try to access a class constant.
+double_colon = dummyClassName::  
Index: modules/simpletest/tests/common_test.module
===================================================================
RCS file: modules/simpletest/tests/common_test.module
diff -N modules/simpletest/tests/common_test.module
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/common_test.module	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,31 @@
+<?php
+// $Id$
+
+/**
+ * @file
+ * A test module to assist in testing common.inc.
+ *
+ * This module can be used whenever a test might potentially throw a fatal error. By
+ * moving those tests to this module, exceptions are thrown in the child process and
+ * cannot hinder or abort the overall (parent) test process.
+ */
+
+/**
+ * Implement hook_menu().
+ */
+function common_test_menu() {
+  $items['common-test/drupal-parse-info-file'] = array(
+    'page callback' => 'common_test_drupal_parse_info_file',
+    'access callback' => TRUE,
+    'type' => MENU_CALLBACK,
+  );
+  return $items;
+}
+
+/**
+ * Test parsing .info files.
+ */
+function common_test_drupal_parse_info_file() {
+  $info_values = drupal_parse_info_file(drupal_get_path('module', 'simpletest') . '/tests/common_test_info.txt');
+  var_export($info_values);
+}
