Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.904
diff -u -r1.904 common.inc
--- includes/common.inc	16 May 2009 19:58:38 -0000	1.904
+++ includes/common.inc	19 May 2009 07:43:45 -0000
@@ -384,7 +384,7 @@
  */
 function drupal_access_denied() {
   drupal_set_header('403 Forbidden');
-  
+
   watchdog('access denied', check_plain($_GET['q']), NULL, WATCHDOG_WARNING);
 
   $path = drupal_get_normal_path(variable_get('site_403', ''));
@@ -1927,7 +1927,7 @@
 /**
  * Return the base URL path (i.e., directory) of the Drupal installation.
  *
- * base_path() prefixes and suffixes a "/" onto the returned path if the path is 
+ * base_path() prefixes and suffixes a "/" onto the returned path if the path is
  * not empty. At the very least, this will return "/".
  *
  * Examples:
@@ -2279,7 +2279,7 @@
  * @return
  *   Contents of the stylesheet including the imported stylesheets.
  */
-function drupal_load_stylesheet_content($contents, $optimize = FALSE) {  
+function drupal_load_stylesheet_content($contents, $optimize = FALSE) {
   // Replaces @import commands with the actual stylesheet content.
   // This happens recursively but omits external files.
   $contents = preg_replace_callback('/@import\s*(?:url\()?[\'"]?(?![a-z]+:)([^\'"\()]+)[\'"]?\)?;/', '_drupal_load_stylesheet', $contents);
@@ -4075,6 +4075,7 @@
  */
 function drupal_parse_info_file($filename) {
   $info = array();
+  $constants = get_defined_constants();
 
   if (!file_exists($filename)) {
     return $info;
@@ -4118,8 +4119,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.38
diff -u -r1.38 common.test
--- modules/simpletest/tests/common.test	16 May 2009 13:26:31 -0000	1.38
+++ modules/simpletest/tests/common.test	19 May 2009 07:43:45 -0000
@@ -899,7 +899,6 @@
  * Tests Simpletest error and exception collecter.
  */
 class DrupalErrorCollectionUnitTest extends DrupalWebTestCase {
-
   /**
    * Errors triggered during the test.
    *
@@ -967,3 +966,34 @@
   }
 }
 
+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->assertText("'simple_string' =&gt; 'A simple string'", t('Simple string value was parsed correctly.'), t('System'));
+    $this->assertText("'simple_constant' =&gt; 6", t('Constant value was parsed correctly.'), t('System'));
+    $this->assertText("'double_colon' =&gt; 'dummyClassName::'", t('Value containing double-colon was parsed correctly.'), t('System'));
+  }
+}
+
+
+
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.info
===================================================================
RCS file: modules/simpletest/tests/common_test_info.info
diff -N modules/simpletest/tests/common_test_info.info
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/common_test_info.info	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,11 @@
+; $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,23 @@
+<?php
+// $Id$
+
+/**
+ * Implementation of 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.info');
+  print_r(var_export($info_values));
+}
