Bug #66572
closedWorkspaces and templavoia
100%
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
Updated by Marti McFlight over 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.
Updated by Kay no-lastname-given over 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() );
Updated by Kay no-lastname-given over 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']; }
Updated by Kay no-lastname-given over 9 years ago
- File patch-66572.diff patch-66572.diff added
I have add a patch
Updated by Alexander Opitz over 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.
Updated by Alexander Opitz over 9 years ago
- Status changed from New to In Progress
- Assignee set to Alexander Opitz
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Gerrit Code Review over 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
Updated by Alexander Opitz over 9 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset fa87c2d63dea6f7db87c9e87868ebde3dca00758.