Bug #82844

Workspaces + Levelmedia + FILES cObject results in fatal error

Added by Paul Beck about 3 years ago. Updated over 1 year ago.

Status:
New
Priority:
Must have
Assignee:
-
Category:
Workspaces
Target version:
-
Start date:
2017-10-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
7.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hey community,

I've found a heavy problem with the components mentioned above.

How to reproduce:

  1. Install "workspaces" extension and create a new workspace
  2. In LIVE workspace add some images to media fields of a page
  3. Switch to the other workspace and just edit anything of the page and save
  4. 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

#1

Updated by Susanne Moog about 3 years ago

  • Category set to Workspaces
#2

Updated by Jasmina Ließmann over 2 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.

#3

Updated by Andreas Lingott about 2 years ago

Same problem with v8.7.18... Is there any chance to get this fixed soon?

#4

Updated by Sascha Löffler over 1 year 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?

Also available in: Atom PDF