Issue Bug Resolved

#110736Permissions of created files are not fixed without target content

Georg Ringer 09/17/26, 19:53 updated 10/10/26, 09:10

Description

TYPO3\CMS\Install\FolderStructure\FileNode::fixSelf() only corrects the
permissions of a newly created file when the node also defines a target
content:

if ($resultCreateFile->getSeverity() === ContextualFeedbackSeverity::OK
    && $this->targetContent !== null
) {
    $result[] = $this->setContent();
    if (!$this->isPermissionCorrect()) {
        $result[] = $this->fixPermission();
    }
}

A file node without a target content is created, but its permissions are
never adjusted to its targetPermission. “Folder structure” then reports a
permission mismatch until “Try to fix errors” is run a second time, because
only the “file already exists” branch of fixSelf() calls
@fixPermission()@.

Writing the content and fixing the permissions are two unrelated steps and
should not be coupled.

Note on impact

This is a latent issue: every file node of the default structure
(DefaultFactory) defines either targetContent or targetContentFile,
and their targetPermission is derived from
@$GLOBALS[‘TYPO3_CONF_VARS’][‘SYS’][‘fileCreateMask’]@, which file creation
applies anyway. It surfaces for structure definitions that omit the target
content or use a targetPermission differing from the file create mask.

Side note

FileNodeTest::createFileThrowsExceptionIfNodeExists() expects exception
code 1366398198, which is thrown by
@AbstractNode::getRelativePathBelowSiteRoot()@ before
@FileNode::createFile()@ can throw its own 1367048077. The test does not
cover the guard it is named after.

Reviews 2

History 13

  1. Gerrit Code Review pushed patch set 1 for main to change 95902 status New Under Review 09/17/26, 20:05

  2. Gerrit Code Review pushed patch set 1 for 14.3 to change 96591 10/10/26, 08:53

  3. Georg Ringer commented and changed status Under Review Resolved done 0 % 100 % 10/10/26, 09:10

    Applied in changeset commit:d57c16c65e4a3ce63cc3aa3f806f55585dab4c5a.