Bug #82844
closed
Workspaces + Levelmedia + FILES cObject results in fatal error
Added by Paul Beck almost 7 years ago.
Updated 11 months ago.
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
Related issues
1 (1 open — 0 closed)
- Category set to Workspaces
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.
Same problem with v8.7.18... Is there any chance to get this fixed soon?
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?
- Status changed from New to Under Review
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
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.
- Precedes Bug #104388: Workspaces + Levelmedia + FILES cObject results in fatal error for hidden/deleted file references added
Also available in: Atom
PDF