#108346Not possible to save site-config with env-var based rootPageId
Description
Hello,
If a site config has a dynamic rootPageId (f.i. env(ROOT_PAGE_ID)) saving of config.yaml is no longer possible via the backend module.
`Existing config for site publikath-692837151d016185672059 not found`
This might be the case because the env variable is substituted after lookup via rootPageId.
Unless root-page-ids are hardcoded, backend module will not work.
Kind regards
Rozbeh Chiryai Sharahi
Reviews 5
- 13.4 94533[BUGFIX] Properly require symfony/polyfill-php84 and php85
- 14.3 94534[BUGFIX] Properly require symfony/polyfill-php84 and php85
- main 94532[BUGFIX] Properly require symfony/polyfill-php84 and php85
- 13.4 93144[BUGFIX] Properly persist ENV variables in site config (rootPageId)
- main 91925[BUGFIX] Properly persist ENV variables in site config (rootPageId)
Related issues 2
History 825
-
Garvin Hicking changed Related to #89077 <span data-processor="relativetime" data-value="2025-11-27T12:33:25+00:00" > 11/27/25, 12:33 </span>
-
Garvin Hicking commented and changed status
NewAccepted <span data-processor="relativetime" data-value="2025-11-27T12:40:10+00:00" > 11/27/25, 12:40 </span> -
Garvin Hicking commented <span data-processor="relativetime" data-value="2025-11-27T12:49:49+00:00" > 11/27/25, 12:49 </span>
This here allows to at least access and save the config. HOWEVER: It then saves the uid inside the config.yaml file, instead of the ‘%env(…)’ placeholder, so that must not happen, there must be another place adjusted as well before the persistance, to use the raw value again.
(Also note: Editing the site will show the Page dropdown with an “INVALID VALUE” setting)
diff --git a/typo3/sysext/backend/Classes/Form/FormDataProvider/SiteDatabaseEditRow.php b/typo3/sysext/backend/Classes/Form/FormDataProvider/SiteDatabaseEditRow.php index 552974850d2..b9d3d454093 100644 --- a/typo3/sysext/backend/Classes/Form/FormDataProvider/SiteDatabaseEditRow.php +++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/SiteDatabaseEditRow.php @@ -51,7 +51,7 @@ readonly class SiteDatabaseEditRow implements FormDataProviderInterface if ($tableName === 'site') { $rootPageId = (int)$result['vanillaUid']; $rowData = $this->getRawConfigurationForSiteWithRootPageId($rootPageId); - $result['databaseRow']['uid'] = $rowData['rootPageId']; + $result['databaseRow']['uid'] = $rootPageId; $result['databaseRow']['identifier'] = $result['customData']['siteIdentifier']; } elseif (in_array($tableName, ['site_errorhandling', 'site_language', 'site_route', 'site_base_variant'], true)) { $rootPageId = (int)($result['inlineTopMostParentUid'] ?? $result['inlineParentUid']); diff --git a/typo3/sysext/backend/Classes/Form/FormDataProvider/SiteTcaInline.php b/typo3/sysext/backend/Classes/Form/FormDataProvider/SiteTcaInline.php index 1d9785096ab..f0bd85b8b39 100644 --- a/typo3/sysext/backend/Classes/Form/FormDataProvider/SiteTcaInline.php +++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/SiteTcaInline.php @@ -121,7 +121,7 @@ class SiteTcaInline extends AbstractDatabaseRecordProvider implements FormDataPr { $connectedUids = []; if ($result['command'] === 'edit') { - $siteConfigurationForPageUid = (int)$result['databaseRow']['rootPageId'][0]; + $siteConfigurationForPageUid = (int)($result['databaseRow']['rootPageId'][0] ?? $result['databaseRow']['uid']); try { $site = $this->siteFinder->getSiteByRootPageId($siteConfigurationForPageUid); } catch (SiteNotFoundException $e) { -
Garvin Hicking commented <span data-processor="relativetime" data-value="2025-11-27T13:21:16+00:00" > 11/27/25, 13:21 </span>
(Note we also don’t seem to have some tests covering the env loading, editing, persisting cycle for
site/xxx/config.yamlin a full suite. Only partially covered through some unit tests for YamlLoading and parts of Site Processing – I only foundtypo3/sysext/core/Tests/Functional/Fixtures/Extensions/test_package_initialization/Initialisation/Site/demo/config.yamlas an entry point to set this up. That’s used intypo3/sysext/core/Tests/Functional/Package/Event/PackageInitializationEventTest.phpbut that tests something completely different) -
Gerrit Code Review pushed patch set 1 for main to change 91925 status
AcceptedUnder Review <span data-processor="relativetime" data-value="2025-11-28T05:51:50+00:00" > 11/28/25, 05:51 </span> -
Gerrit Code Review pushed patch set 2 for main to change 91925 <span data-processor="relativetime" data-value="2025-11-28T05:58:19+00:00" > 11/28/25, 05:58 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 91925 <span data-processor="relativetime" data-value="2025-11-28T07:06:08+00:00" > 11/28/25, 07:06 </span>
-
Gerrit Code Review pushed patch set 4 for main to change 91925 <span data-processor="relativetime" data-value="2025-11-28T07:12:21+00:00" > 11/28/25, 07:12 </span>
-
Gerrit Code Review pushed patch set 5 for main to change 91925 <span data-processor="relativetime" data-value="2025-11-28T07:24:40+00:00" > 11/28/25, 07:24 </span>
-
Gerrit Code Review pushed patch set 6 for main to change 91925 <span data-processor="relativetime" data-value="2025-11-28T08:24:19+00:00" > 11/28/25, 08:24 </span>
-
Gerrit Code Review pushed patch set 7 for main to change 91925 <span data-processor="relativetime" data-value="2026-02-06T15:01:46+00:00" > 02/06/26, 15:01 </span>
-
Garvin Hicking commented <span data-processor="relativetime" data-value="2026-02-06T15:10:36+00:00" > 02/06/26, 15:10 </span>
Steps to reproduce this problem with DDEV as an example, and a page UID 195 (the page needs to exist):
1. Create a new site config (via GUI or via filesystem).
2. Create an ENV variable in your setup webserver setup, like
'TYPO3_ROOT_PAGE_UID="195". In DDEV this can be done by editing.ddev/config.yamland placing the code:web_environment: - TYPO3_ROOT_PAGE_UID=1953. Restart DDEV to apply the ENV variable
4. Edit the
sites/xxx/config.yamlfile, set:base: 'https://%env(DDEV_HOSTNAME)%/your-demo' rootPageId: '%env(TYPO3_ROOT_PAGE_UID)%' websiteTitle: 'Breaking demo for page %env(TYPO3_ROOT_PAGE_UID)%' languages: - title: English enabled: true languageId: 0 base: / locale: en_US.UTF-8 navigationTitle: English flag: us typo3Language: default iso-639-1: en hreflang: en-US direction: ltr websiteTitle: ''5. Clear TYPO3 cache, enter site config, pick the created site
6. Note that website title and base URI are shown with their
%env(...)%entries in the input fields7. Also note that the root page id dropdown will complain about a “missing label” for the ENV entry
8. Also note that your frontend site will work just fine, ENV vars are resolved/processed
9. Now change something, like the website title. Save the site config.
10. Boom, you’ll see an exception about a missing site identifier.
11. Enter site config again and you’ll see warnings of what just happened.
12. Check out
config.yamland note that the website title was not changed13. Take note that due to this, you are incapable to actually edit ANYTHING in the site config via GUI
-
Gerrit Code Review pushed patch set 8 for main to change 91925 <span data-processor="relativetime" data-value="2026-02-06T15:15:59+00:00" > 02/06/26, 15:15 </span>
-
Gerrit Code Review pushed patch set 9 for main to change 91925 <span data-processor="relativetime" data-value="2026-02-13T07:41:03+00:00" > 02/13/26, 07:41 </span>
-
Gerrit Code Review pushed patch set 10 for main to change 91925 <span data-processor="relativetime" data-value="2026-02-13T08:15:57+00:00" > 02/13/26, 08:15 </span>
-
Gerrit Code Review pushed patch set 11 for main to change 91925 <span data-processor="relativetime" data-value="2026-02-13T08:18:53+00:00" > 02/13/26, 08:18 </span>
-
Gerrit Code Review pushed patch set 12 for main to change 91925 <span data-processor="relativetime" data-value="2026-02-13T08:30:52+00:00" > 02/13/26, 08:30 </span>
-
Gerrit Code Review pushed patch set 13 for main to change 91925 <span data-processor="relativetime" data-value="2026-02-13T10:25:58+00:00" > 02/13/26, 10:25 </span>
-
Gerrit Code Review pushed patch set 14 for main to change 91925 <span data-processor="relativetime" data-value="2026-02-13T10:32:20+00:00" > 02/13/26, 10:32 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 93144 <span data-processor="relativetime" data-value="2026-03-10T13:11:37+00:00" > 03/10/26, 13:11 </span>
-
Gerrit Code Review pushed patch set 2 for 13.4 to change 93144 <span data-processor="relativetime" data-value="2026-03-10T13:18:25+00:00" > 03/10/26, 13:18 </span>
-
Gerrit Code Review pushed patch set 3 for 13.4 to change 93144 <span data-processor="relativetime" data-value="2026-03-10T14:02:50+00:00" > 03/10/26, 14:02 </span>
-
Rozbeh Chiryai Sharahi commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-03-10T14:15:09+00:00" > 03/10/26, 14:15 </span>Applied in changeset commit:1312dcbfd579bb2e59bc249a976af3cee21f9f21.
-
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2026-03-31T09:00:57+00:00" > 03/31/26, 09:00 </span> -
Garvin Hicking changed Related to #110079 <span data-processor="relativetime" data-value="2026-06-18T19:23:59+00:00" > 06/18/26, 19:23 </span>
First off: I think we should support this use-case.
The reason is that at several places we use the “raw” configuration page UID. And this will hold a value like
'%env(PAGEUID)%'then, and not resolve to a real UID.There are calls to
getRawConfigurationForSiteWithRootPageIdin several FormEngine DataProviders liketypo3/sysext/backend/Classes/Form/FormDataProvider/SiteDatabaseEditRow.phpwhich also access the ‘vanillaUid’.I suppose if we very carefully pick the places where ‘rootPageUid’ is accessed from that raw result and replace them with ‘vanillaUid’ this could work. And the UID resolving then here:
typo3/sysext/backend/Classes/Controller/SiteConfigurationController.php->
public function editAction(ServerRequestInterface $request): ResponseInterface { ... $formData = $this->formDataCompiler->compile($formDataCompilerInput, GeneralUtility::makeInstance(SiteConfigurationDataGroup::class)); ...could use a better evaluation, and maybe this allows to make further code also fall in place.
Looking forward to more investigation and your input, thanks for reporting :)