diff --git a/core/includes/install.inc b/core/includes/install.inc index b778e30..e0890a1 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -209,7 +209,7 @@ function drupal_rewrite_settings($settings = array(), $settings_file = NULL) { } $contents = file_get_contents(DRUPAL_ROOT . '/' . $settings_file); if ($contents !== FALSE) { - // Append PHP tag if the settings.php file is empty. + // Initialize the contents for the settings.php file if it is empty. if ($contents == '') { $contents = " array( 'no_index_value_scalar' => (object) array( @@ -121,9 +122,12 @@ function testDrupalRewriteSettings() { ), 'expected' => '$no_index_value_scalar = false; // comment' ); + // Make an empty file. $filename = variable_get('file_public_path', conf_path() . '/files') . '/empty_settings.php'; file_put_contents(DRUPAL_ROOT . '/' . $filename, ""); + // Write the setting to the file. drupal_rewrite_settings($test['settings'], $filename); + // Check that the result is just the php opening tag and the settings. $this->assertEqual(file_get_contents(DRUPAL_ROOT . '/' . $filename), "