diff --git a/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php index 1eecc84979..daed84c99b 100644 --- a/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php +++ b/core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php @@ -152,11 +152,13 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#required' => TRUE, '#weight' => -20, ]; - $default_site_mail = $this->config('system.site')->get('mail'); + // Use the default site mail if one is already configured, or fall back to + // PHP's configured sendmail_from. + $default_site_mail = $this->config('system.site')->get('mail') ?: ini_get('sendmail_from'); $form['site_information']['site_mail'] = [ '#type' => 'email', '#title' => $this->t('Site email address'), - '#default_value' => empty($default_site_mail) ? ini_get('sendmail_from') : $default_site_mail, + '#default_value' => $default_site_mail, '#description' => $this->t("Automated emails, such as registration information, will be sent from this address. Use an address ending in your site's domain to help prevent these emails from being flagged as spam."), '#required' => TRUE, '#weight' => -15, @@ -200,12 +202,14 @@ public function buildForm(array $form, FormStateInterface $form_state) { '#description' => $this->t('Select the default country for the site.'), '#weight' => 0, ]; - $default_timezone = $this->config('system.date')->get('timezone.default'); + // Use the default site timezone if one is already configured, or fall back + // to the system timezone if set (and avoid throwing a warning in + // PHP >=5.4). + $default_timezone = $this->config('system.date')->get('timezone.default') ?: @date_default_timezone_get(); $form['regional_settings']['date_default_timezone'] = [ '#type' => 'select', '#title' => $this->t('Default time zone'), - // Use system timezone if set, but avoid throwing a warning in PHP >=5.4 - '#default_value' => empty($default_timezone) ? @date_default_timezone_get() : $default_timezone, + '#default_value' => $default_timezone, '#options' => system_time_zones(NULL, TRUE), '#description' => $this->t('By default, dates in this site will be displayed in the chosen time zone.'), '#weight' => 5,