diff --git a/core/includes/install.inc b/core/includes/install.inc index 2ee8371..1b3d9a3 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) { // Initialize the contents for the settings.php file if it is empty. - if ($contents == '') { + if (trim($contents) === '') { $contents = " array( - 'no_index_value_scalar' => (object) array( - 'value' => FALSE, - 'comment' => 'comment', - 'required' => TRUE, + 'no_index' => (object) array( + 'value' => TRUE, + 'required' => TRUE, ), ), - 'expected' => '$no_index_value_scalar = false; // comment' + 'expected' => '$no_index = TRUE;' ); // Make an empty file. - $filename = variable_get('file_public_path', conf_path() . '/files') . '/empty_settings.php'; + $filename = settings()->get('file_public_path', conf_path() . '/files') . '/mock_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), "