Bug #82330

cant create inline records if ctrl > enablecolumns > endtime is not specified in childrens TCA

Added by Tobias Liebig 5 months ago. Updated 5 months ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
-
Target version:
Start date:
2017-09-07
Due date:
% Done:

100%

TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
easy
Is Regression:
Yes
Sprint Focus:

Description

In 7.6.22 i can't create new inline child records, if the child TCA does not specify ctrl >enablecolumns > endtime.

When trying to create a new inline record, the BE shows an "Error 500 Internal Server Error" notification and sys_log logs an "Uncaught TYPO3 Exception":

Core: Exception handler (WEB): Uncaught TYPO3 Exception: Unsupported operand types | Error thrown in file /Users/tobias/ownCloud/Projekte/etobi/devdev7/vendor/typo3/cms/typo3/sysext/backend/Classes/Utility/BackendUtility.php in line 1555. Requested URL: http://devdev7.dev/typo3/index.php?ajaxID=%%2Fajax%%2Frecord%%2Finline%%2Fcreate&ajaxToken=d3804bcc88a0d5127fbc06f7bf2bb7e7e48b5d9a

Setup/Steps to reproduce:

  • TYPO3 7.6.22
  • two tables (parent record and child record)
  • the parent record have an inline relation to the child records
  • both recors are NOT localizable (thus NO TCA ctrl > languageField specified)
  • the child record DOES NOT specify enablecolumns > endtime
  • create a new parent record
  • create a new inline child record
  • the Ajax call will throw an "Uncaught TYPO3 Exception: Unsupported operand types"

Analysis:

In \TYPO3\CMS\Backend\Controller\FormInlineAjaxController L138-L140:
As $GLOBALS['TCA'][$parent['table']]['ctrl']['languageField']; and $GLOBALS['TCA'][$child['table']]['ctrl']['languageField']; are empty, an array like [0 => ''] will be added to $childData['databaseRow'] with an empty index key.

Later $childData['databaseRow'] will be passed to \TYPO3\CMS\Backend\Utility\BackendUtility::getRecordIconAltText.

At the end of getRecordIconAltText L2025 the records endtime is read. As enablecolumns > endtime is not specified, $ctrl['endtime'] will be empty and $row[$ctrl['endtime']] will return the [0 => ''] array added in FormInlineAjaxController L140.

$row[$ctrl['endtime']] (the [0 => ''] array) will be passed to \TYPO3\CMS\Backend\Utility\BackendUtility::daysUntil.

$delta_t = $tstamp - $GLOBALS['EXEC_TIME']; throws the "Unsupported operand types" as you can't subtract an int from an array.

This bug does not happen for starttime, as $ctrl['starttime'] as this is checked in \TYPO3\CMS\Backend\Utility\BackendUtility L2020

Solution:
  • check if ['ctrl']['languageField'] (both for parent and child) are not empty in \TYPO3\CMS\Backend\Controller\FormInlineAjaxController L136
  • check if $ctrl['endtime'] is not empty in \TYPO3\CMS\Backend\Utility\BackendUtility L2025

Related issues

Related to TYPO3 Core - Bug #48883: Wrong sys_language_uid in sys_file_reference Resolved 2013-06-05
Related to TYPO3 Core - Bug #76048: IRRE: Child records - New record doesn't get language of parent (non localized records but using new button) Resolved 2016-05-04
Related to TYPO3 Core - Bug #73609: Creating IRRE child element without language of parent element Closed 2016-02-22
Duplicated by TYPO3 Core - Bug #82391: Inline records in TYPO3 v. 7.6.22 crash when NOT having sys_language_uid on children Closed 2017-09-08
Duplicated by TYPO3 Core - Bug #82564: Error when adding inline record that has no endtime column configured Rejected 2017-09-26

Associated revisions

Revision e81ced3b (diff)
Added by Oliver Hader 5 months ago

[BUGFIX] IRRE: Check if TCA['ctrl']['languageField'] is set

On creating child records for an inline field, the values of
TCA['ctrl']['languageField'] configuration of parent and child
records are used without checking if they are set at all.
This patch adds appropriate guards.

Resolves: #82330
Releases: 7.6
Change-Id: I6383e55820239b0363ff890855430ac32e2cdf62
Reviewed-on: https://review.typo3.org/53944
Reviewed-by: Tobias Liebig <>
Tested-by: TYPO3com <>
Reviewed-by: Oliver Hader <>
Tested-by: Oliver Hader <>

Revision 9c2b9b33 (diff)
Added by Nicole Cordes 4 months ago

[FOLLOWUP][BUGFIX] IRRE: Check if TCA['ctrl']['languageField'] is set

This patch adds missing functional tests for
\TYPO3\CMS\Backend\Controller\FormInlineAjaxController::createAction

Related: #82330
Releases: master, 8.7, 7.6
Change-Id: I61c8c07dd0d2c6a92bb445d7f2b6baee23251f5d
Reviewed-on: https://review.typo3.org/54171
Tested-by: TYPO3com <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Reviewed-by: Frank Naegler <>
Tested-by: Frank Naegler <>

Revision b2638da5 (diff)
Added by Nicole Cordes 4 months ago

[FOLLOWUP][BUGFIX] IRRE: Check if TCA['ctrl']['languageField'] is set

This patch adds missing functional tests for
\TYPO3\CMS\Backend\Controller\FormInlineAjaxController::createAction

Related: #82330
Releases: master, 8.7, 7.6
Change-Id: I61c8c07dd0d2c6a92bb445d7f2b6baee23251f5d
Reviewed-on: https://review.typo3.org/54175
Tested-by: TYPO3com <>
Reviewed-by: Frank Naegler <>
Tested-by: Frank Naegler <>

Revision 33b504f1 (diff)
Added by Nicole Cordes 4 months ago

[FOLLOWUP][BUGFIX] IRRE: Check if TCA['ctrl']['languageField'] is set

This patch adds missing functional tests for
\TYPO3\CMS\Backend\Controller\FormInlineAjaxController::createAction

Related: #82330
Releases: master, 8.7, 7.6
Change-Id: I61c8c07dd0d2c6a92bb445d7f2b6baee23251f5d
Reviewed-on: https://review.typo3.org/54170
Tested-by: TYPO3com <>
Reviewed-by: Frank Naegler <>
Tested-by: Frank Naegler <>

History

#2 Updated by Sven Juergens 5 months ago

same problem here, thanks for explanation Tobias

#3 Updated by Tobias Liebig 5 months ago

Does not occur in 7.6.21 and 8.7.6

#4 Updated by Tobias Liebig 5 months ago

#5 Updated by Gerrit Code Review 5 months ago

  • Status changed from New to Under Review

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53944

#6 Updated by Gerrit Code Review 5 months ago

Patch set 2 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53944

#7 Updated by Tymoteusz Motylewski 5 months ago

@Tobias - does it, or does it NOT occurs in 7.6 and 8.6 ?

#8 Updated by Gerrit Code Review 5 months ago

Patch set 3 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53944

#9 Updated by Tobias Liebig 5 months ago

Tymoteusz Motylewski wrote:

@Tobias - does it, or does it NOT occurs in 7.6 and 8.6 ?

  • It DOES occur in 7.6.22 (a regression introduced with 7.6.22)
  • It DOES NOT occur in 7.6.21
  • It DOES NOT occur in 8.*
  • It DOES NOT occur in master

#10 Updated by Tobias Liebig 5 months ago

umm.. i took a moment to think about it.

while the described issue itself does not occure in 8.* and master (because it's a combination of two missing checks) it totally makes sense to apply the part in "BackendUtility.php" to master and 8.7, too.

I'll take care of that.

Should I separate the part in "BackendUtility" (which then applies to 7.6, 8.7 and master) and "FormInlineAjaxController" (which only applies to 7.6) and push two separate changes?
Or could that all be handled in one review/changeset?

#11 Updated by Mathias Brodala 5 months ago

  • Duplicated by Bug #82391: Inline records in TYPO3 v. 7.6.22 crash when NOT having sys_language_uid on children added

#12 Updated by Mathias Brodala 5 months ago

  • Related to Bug #48883: Wrong sys_language_uid in sys_file_reference added

#13 Updated by Mathias Brodala 5 months ago

  • Related to Bug #76048: IRRE: Child records - New record doesn't get language of parent (non localized records but using new button) added

#14 Updated by Mathias Brodala 5 months ago

  • Related to Bug #73609: Creating IRRE child element without language of parent element added

#15 Updated by Gerrit Code Review 5 months ago

Patch set 4 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53944

#16 Updated by Oliver Hader 5 months ago

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

#17 Updated by Stephan GroƟberndt 5 months ago

  • Duplicated by Bug #82564: Error when adding inline record that has no endtime column configured added

Also available in: Atom PDF