Bug #66572

Workspaces and templavoia

Added by Klaus Moser about 4 years ago. Updated 9 months ago.

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

100%

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.

patch.diff View (2.38 KB) Klaus Moser, 2015-04-24 14:46

patch-66572.diff View (3.76 KB) Kay no-lastname-given, 2015-05-11 14:46


Related issues

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

Associated revisions

Revision fa87c2d6 (diff)
Added by Alexander Opitz about 4 years ago

[BUGFIX] Respect _FILE/_STRING in versioning

References with _FILE/_STRING as ref_table have special meanings and
can't be loaded from database.

Resolves: #66572
Releases: master, 6.2
Change-Id: Ibc942c600652a005368e1eab67cbc24f4efb7dde
Reviewed-on: http://review.typo3.org/39856
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>
Reviewed-by: Wouter Wolters <>
Tested-by: Wouter Wolters <>

Revision 02d4907e (diff)
Added by Alexander Opitz about 4 years ago

[BUGFIX] Respect _FILE/_STRING in versioning

References with _FILE/_STRING as ref_table have special meanings and
can't be loaded from database.

Resolves: #66572
Releases: master, 6.2
Change-Id: Ibc942c600652a005368e1eab67cbc24f4efb7dde
Reviewed-on: http://review.typo3.org/40045
Reviewed-by: Wouter Wolters <>
Tested-by: Wouter Wolters <>

History

#1 Updated by Martin Eberle about 4 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.

#2 Updated by Kay no-lastname-given about 4 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()
);

#3 Updated by Kay no-lastname-given about 4 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'];
}

#4 Updated by Kay no-lastname-given about 4 years ago

I have add a patch

#5 Updated by Alexander Opitz about 4 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.

#6 Updated by Alexander Opitz about 4 years ago

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

#7 Updated by Gerrit Code Review about 4 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

#8 Updated by Gerrit Code Review about 4 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

#9 Updated by Gerrit Code Review about 4 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

#10 Updated by Gerrit Code Review about 4 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

#11 Updated by Alexander Opitz about 4 years ago

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

#12 Updated by Benni Mack 9 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF