[SOLVED] Bug? Site settings get set to default when any setting is changed via backend

Hello!
I’ve run into an issue and I’m unsure wether I’ve done something wrong or it’s a bug in TYPO3.

I have an extension that provides some content elements. And it provides some settings to set template paths, etc. These settings are readonly, because I don’t want backend editors to modify them. For a site I’m working on I’ve set these settings by changing the values in config/sites/*/settings.yaml.

The values I entered are visible in the site settings module in the backend and work as expected. But whenever I set any setting via the backend and not via modifying the settings.yaml, my previously defined settings get deleted. As if the system didn’t fully recognize/save them.

To give more context, these are my settings definitions (labels omitted):

categories:
  T3BlockBase:
    label: ""

settings:
  t3-block-base.templatePath:
    label: ""
    description: ""
    category: T3BlockBase
    type: string
    default: ''
    readonly: true
  t3-block-base.previewTemplatePath:
    label: ""
    description: ""
    category: T3BlockBase
    type: string
    default: ''
    readonly: true
  t3-block-base.partialPath:
    label: ""
    description: ""
    category: T3BlockBase
    type: string
    default: ''
    readonly: true

In my config/sites/*/settings.yaml, I have set these values:

styles.templates.templateRootPath: 'EXT:wfg/Resources/Private/Templates/'
t3-block-base.templatePath: 'EXT:wfg/Resources/Private/Templates/'
t3-block-base.previewTemplatePath: 'EXT:wfg/Resources/Private/TemplatesPreview/'
t3-block-base.partialPath: 'EXT:wfg/Resources/Private/Partials/'

The setting styles.templates.templateRootPath I think comes from Fluid Styled Content, and is editable via the backend. If I for example edit this value via the backend, all my custom t3-block-base.* settings get set to their default value (deleted, because empty string).

Is this a bug? TYPO3 13.4.15

Edit: This happens whenever site settings are saved via the backend - modified or not doesnt matter. All settings that have only been defined by directly writing to settings.yaml get set to default.

Would you be able to provide a full variant of your yaml files to reproduce? I wonder if some YAML parse error occurs. Did you test this with debug mode enabled to see if there are exceptions?

Any extensions involved that utilize PSR event listeners?

I’ll try to put together a repro. I had debug mode enabled but couldn’t observe any obvious errors. As for event listeners I’m only using PageContentPreviewRenderingEvent but I guess this shouldn’t matter in this case.

Repost because I forgot to clean up some stuff in the reproduction.

I found the issue. If I remove readonly: true from a setting definition, the value is persisted correctly. Readonly settings seem to get reset to default anytime the saveAction is performed for the SiteSettingsController. But that means that editors could update the value and potentially break things, which I don’t want.
For now I guess I have no other choice than to make all settings editable, as random resets mean that even more things break.

Thanks a lot! We added this to our bugtracker Bug #107224: Site settings readonly values are discarded on save - TYPO3 Core - TYPO3 Forge and are investigating! :slight_smile:

1 Like