Project

General

Profile

Actions

Bug #66572

closed

Workspaces and templavoia

Added by Klaus Moser almost 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Category:
Workspaces
Target version:
-
Start date:
2015-04-24
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
hard
Is Regression:
No
Sprint Focus:

Description

We encountered an issue with using workspaces with templavoila in a Typo3 6.2.12. When linking a file, typing an email address into a text field or referencing an image in a templavoila FCE the "Workspaces" backend module fails to load the changes and quits with different error messages and makes the backend module unusable.

If you write an email address into a textfield the error message is 'Element

router
_STRING:0" does not exist

If there is a reference to a file the message is

router
Element "_FILE:0" does not exist

Or links to files

router
Element "sys_file:1234" does not exist

This is because fields from tt_content with type flex get checked for child elements in table sys_refindex and those records are tried to be loaded from database. Those entries look like this (shortend):

tablename - field - ref_table - ref_uid - ref_string
tt_content - tx_templavoila_flex - _STRING - 0 - test@example.com
tt_content - tx_templavoila_flex - _FILE - 0 - uploads/tx_templavoila/example.jpg
tt_content - tx_templavoila_flex - sys_file - 4120 -

These records are then tried to be fetched from database. The result is queries that try to acquire uid 0 from e.g. table _STRING which naturally will fail.

In case of links to files in FAL it fails because sys_file is not versionable.

I figured out a way to fix the errors so the workspace module is showing up correctly. Because workspaces and versioning are pretty hard to understand i'm not quite sure if this is the right approch.

The fix changes the two files typo3/sysext/version/Classes/Dependency/DependencyEntityFactory.php and typo3/sysext/version/Classes/Dependency/ElementEntity.php and adds a check if the table to be queried even exists and is also versionable before trying to load a referenced object.


Files

patch.diff (2.38 KB) patch.diff Klaus Moser, 2015-04-24 14:46
patch-66572.diff (3.76 KB) patch-66572.diff Kay no-lastname-given, 2015-05-11 14:46

Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #66523: Refindex error for link wizard fields in flexformsClosed2015-04-21

Actions
Actions #1

Updated by Marti McFlight almost 9 years ago

We’re experiencing the same problem with TemplaVoila! and TYPO3 6.2.11 as well as with TYPO3 6.2.12.

The patch from Klaus Moser didn’t solve this for us.

Actions #2

Updated by Kay no-lastname-given almost 9 years ago

After patching my System I am get a error

Fatal error: Call to a member function getElement() on a non-object in typo3_src/typo3/sysext/version/Classes/Dependency/ElementEntity.php on line 290

it looks that the $this->parents array contains now NULL-entries

var_dump($this->parents);
array(2) {
  [0]=>
  NULL
  [1]=>
  NULL
}

I think if the DependencyEntityFactory::getReferencedElement return NULL it should not added to the array

$this->parents[] = $this->getDependency()->getFactory()->getReferencedElement(
    $row['tablename'],
    $row['recuid'],
    $row['field'],
    array(),
    $this->getDependency()
);

Actions #3

Updated by Kay no-lastname-given almost 9 years ago

Your isVersionable method is not correct, because 'versioningWS' can be a boolean or an integer (version number).

http://docs.typo3.org/typo3cms/TCAReference/Reference/Ctrl/Index.html#versioningws

So you should cast to bool and test if versioningWS is true.

/**
 * Check if versioning is enabled .
 *
 * @return boolean
 */
protected function isVersionable($table) {
    return (bool)$GLOBALS['TCA'][$table]['ctrl']['versioningWS'];
}
Actions #4

Updated by Kay no-lastname-given almost 9 years ago

I have add a patch

Actions #5

Updated by Alexander Opitz almost 9 years ago

In TYPO3\CMS\Core\Database\ReferenceIndex there is following definition:

$ref_table For database references; the tablename the reference points to. Special keyword "_FILE" indicates
that "ref_string" is a file reference either absolute or relative to PATH_site. Special keyword "_STRING" indicates
some special usage (typ. softreference) where "ref_string" is used for the value.

which isn't handled anywhere.

TYPO3\CMS\Version\Dependency\ElementEntity::getChildren() do not respect this.

Actions #6

Updated by Alexander Opitz almost 9 years ago

  • Status changed from New to In Progress
  • Assignee set to Alexander Opitz
Actions #7

Updated by Gerrit Code Review almost 9 years ago

  • Status changed from In Progress to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39856

Actions #8

Updated by Gerrit Code Review almost 9 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39856

Actions #9

Updated by Gerrit Code Review almost 9 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/39856

Actions #10

Updated by Gerrit Code Review almost 9 years ago

Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40045

Actions #11

Updated by Alexander Opitz almost 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #12

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF