Bug #82844
closedWorkspaces + Levelmedia + FILES cObject results in fatal error
100%
Description
Hey community,
I've found a heavy problem with the components mentioned above.
How to reproduce:
- Install "workspaces" extension and create a new workspace
- In LIVE workspace add some images to media fields of a page
- Switch to the other workspace and just edit anything of the page and save
- Push the changes to LIVE
On saving the page in a workspace, the sys_file_reference records will be copied for the workspace with pid "-1".
When pushing to LIVE, the pid will stay on "-1".
Now a FILES object like this
lib.headerimage.10 = FILES lib.headerimage.10 { references { data = levelmedia: -1, slide } begin = 0 maxItems = 1 renderObj = IMAGE renderObj { file.import.data = file:current:uid file.treatIdAsReference = 1 file.maxW = 730 file.maxH = 200 altText.data = file:current:title wrap = <div id="headerimage">| </div> } }
will cause
No file reference (sys_file_reference) was found for given UID: "16326"
Tested in
TYPO3 7.6.20, 7.6.23
PHP 5.6, 7.1
Updated by Jasmina Ließmann about 6 years ago
I can confirm the issue, but to me the error only occurs in the workspace preview. After pushing the changes to live workspace everything works fine.
By adding a file reference in workspace mode two entries are made in table 'sys_file_reference':- an 'INITIAL PLACEHOLDER' with the correct pid
- an 'First draft version' with pid '-1'
In workspace preview the content object FILES uses the entry 'First draft version', where the pid is unusable.
After publishing the 'First draft version' will be replaced by the 'INITIAL PLACEHOLDER' entry and everything works fine.
Tested with TYPO3 CMS 8.7.15 and PHP 7.2.
Updated by Andreas Lingott almost 6 years ago
Same problem with v8.7.18... Is there any chance to get this fixed soon?
Updated by Sascha Löffler almost 5 years ago
Problem also exists in TYPO3 v9.5.9
In some tests until now i could solve it with changing the method enrichWithRelationFields inside the core/Classes/Utility/RootlineUtility.php.
i extended the query
$queryBuilder = $connectionPool->getQueryBuilderForTable($table);
$queryBuilder->getRestrictions()->removeAll()
->add(GeneralUtility::makeInstance(DeletedRestriction::class))
->add(GeneralUtility::makeInstance(HiddenRestriction::class));
$queryBuilder->select('uid')
->from($table)
->where(
$queryBuilder->expr()->eq(
$configuration['foreign_field'],
$queryBuilder->createNamedParameter(
$uid,
\PDO::PARAM_INT
)
)
)
);
with the following:
$queryBuilder = $connectionPool->getQueryBuilderForTable($table);
$queryBuilder->getRestrictions()->removeAll()
->add(GeneralUtility::makeInstance(DeletedRestriction::class))
->add(GeneralUtility::makeInstance(HiddenRestriction::class));
$queryBuilder->select('uid')
->from($table)
->where(
$queryBuilder->expr()->eq(
$configuration['foreign_field'],
$queryBuilder->createNamedParameter(
$uid,
\PDO::PARAM_INT
)
)
)->andWhere( // @todo fix for workspace
$queryBuilder->expr()->eq(
't3ver_wsid',
$queryBuilder->createNamedParameter(
$this->workspaceUid,
\PDO::PARAM_INT
)
)
);
But i bet this will have some other sideeffects.
For example could the entry have some relations where the `t3ver_wsid` field does not exist?
Updated by Gerrit Code Review over 2 years ago
- Status changed from New to Under Review
Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72273
Updated by Gerrit Code Review over 2 years ago
Patch set 8 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72273
Updated by Gerrit Code Review over 2 years ago
Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/72417
Updated by Benni Mack over 2 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 8583e6ac64f2918f022e776063e93881005bbc7d.
Updated by Philipp Kitzberger 11 months ago
I can still reproduce this bug with TYPO3 11.5.31 and PHP 8.1!
Both with the cObject FILES and with FilesProcessor.
page.10 { variables.files = FILES variables.files.references.data = levelmedia:-1,slide dataProcessing.10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor dataProcessing.10.references.data = levelmedia:-1,slide }
The above mentioned change 8583e6ac64f2918f022e776063e93881005bbc7d is fixing the issue AFTER having published the deleted (or hidden) file references. That's fine.
But having the deleted (t3ver_state=2) or hidden=1 file reference in a draft workspace is still throwing that exception when previewing that page in draft preview:
No file reference (sys_file_reference) was found for given UID: "40907"
So this issue is not closed at all, I'm afraid.
Updated by Philipp Kitzberger about 1 month ago
- Precedes Bug #104388: Workspaces + Levelmedia + FILES cObject results in fatal error for hidden/deleted file references added