Issue Bug Under Review Stale

#110550SiteSettingsService::writeSettings() silently swallows SiteConfigurationWriteException

Simon Schmidt 08/28/26, 05:19 updated 09/15/26, 10:07

Description

Bug Description

SiteSettingsService::writeSettings() silently catches SiteConfigurationWriteException internally and never re-throws it. As a result, callers have no way to detect whether a write succeeded or failed.

Root Cause

In EXT:core Classes/Site/SiteSettingsService.php, writeSettings() calls SiteWriter::writeConfiguration() inside a try/catch block that catches SiteConfigurationWriteException, enqueues a flash message, and returns — silently discarding the exception.

try {
    $siteWriter->writeConfiguration($mergedSettings, $site->getIdentifier());
} catch (SiteConfigurationWriteException $e) {
    $flashMessage = GeneralUtility::makeInstance(
        FlashMessage::class,
        $e->getMessage(),
        '',
        ContextualFeedbackSeverity::ERROR,
        true
    );
    $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
    $flashMessageService->getMessageQueueByIdentifier()->enqueue($flashMessage);
    // exception is swallowed — no rethrow
}

Flash messages are invisible in CLI and API contexts. Callers are forced to verify writes by re-reading the settings file, which is fragile.

Affected Versions

Verified in:
  • TYPO3 13.4 (LTS)
  • TYPO3 14.3
  • TYPO3 main (future 15.x)

Expected Behavior

SiteSettingsService::writeSettings() should re-throw SiteConfigurationWriteException after enqueuing the flash message, so callers can handle write failures.

Proposed Fix

Add throw $e; after enqueuing the flash message:

} catch (SiteConfigurationWriteException $e) {
    $flashMessage = GeneralUtility::makeInstance(
        FlashMessage::class,
        $e->getMessage(),
        '',
        ContextualFeedbackSeverity::ERROR,
        true
    );
    $flashMessageService = GeneralUtility::makeInstance(FlashMessageService::class);
    $flashMessageService->getMessageQueueByIdentifier()->enqueue($flashMessage);
    throw $e; // re-throw so callers can handle the failure
}

Note: In TYPO3 main (v15), FlashMessage is final, so new FlashMessage(...) replaces GeneralUtility::makeInstance().

I will create a patch for this.

Reviews 3

History 214

  1. Simon Schmidt commented and changed TYPO3 Version 15 13 <span data-processor="relativetime" data-value="2026-08-28T05:53:53+00:00" > 08/28/26, 05:53 </span>

    Bug Description

    SiteSettingsService::writeSettings() silently catches SiteConfigurationWriteException internally and never re-throws it. As a result, callers have no way to detect whether a write succeeded or failed.

    Root Cause

    In EXT:core Classes/Site/SiteSettingsService.php, writeSettings() calls SiteWriter::writeConfiguration() inside a try/catch block that catches SiteConfigurationWriteException, enqueues a flash message, and returns — silently discarding the exception.

    Flash messages are invisible in CLI and API contexts. Callers are forced to verify writes by re-reading the settings file, which is fragile.

    Affected Versions

    Verified in:
    • TYPO3 13.4 (LTS)
    • TYPO3 14.3
    • TYPO3 main (future 15.x)

    Expected Behavior

    SiteSettingsService::writeSettings() should propagate SiteConfigurationWriteException so callers can handle write failures appropriately.

    Proposed Fix

    Two changes:

    1. Remove the try/catch from SiteSettingsService::writeSettings() entirely — let SiteConfigurationWriteException propagate naturally from SiteWriter. Remove the now-unused FlashMessageService dependency from the service.
    1. In SiteSettingsController::saveAction(), wrap the writeSettings() call in a try/catch: on failure, add a flash message and redirect back to the edit page.

    This cleanly separates concerns: the service is purely functional, the controller is responsible for UI feedback.

    I will create a patch for this.