Bug #82104

IRRE + GROUP with real MM relations not working (fatal error)

Added by Ronald Kools over 2 years ago. Updated 10 months ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
FormEngine aka TCEforms
Target version:
-
Start date:
2017-08-15
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
7.0
Tags:
group, irre, relations
Complexity:
Is Regression:
Sprint Focus:

Description

See /typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php line 189:

  if ($type === 'select') {
         // A resolved select field is an array - take first value
         $value = $value['0'];
  } else {
         // A group field is still a list with pipe separated uid|tableName
          $valueParts = GeneralUtility::trimExplode('|', $value);
          $itemParts = explode('_', $valueParts[0]);
          $value = [
                'uid' => array_pop($itemParts),
                'table' => implode('_', $itemParts)
          ];
  }
  // @todo: This is weird, $value has different structure for group and select fields?
  $uniqueIds[$child['databaseRow']['uid']] = $value;

The ToDo says it all. ;-)

When not using a SELECT but a GROUP, this functions assumes the value is a string with a pipe for uid / tablename. However, when using real MM relations, $value contains an array with the uid and tablenames. This results in a fatal error:

#1476107295: PHP Warning: explode() expects parameter 2 to be string, array given in /vendor/typo3/cms/typo3/sysext/core/Classes/Utility/GeneralUtility.php line 1297 (More information)

sample_0.0.1_201809271609.zip (7.55 KB) Cyril Janody, 2018-09-28 00:19


Related issues

Related to TYPO3 Core - Bug #84735: InlineControlContainer wrongly assumes group field values are still a string Closed 2018-04-15

Associated revisions

Revision db3a3ccc (diff)
Added by Cyril Janody over 1 year ago

[BUGFIX] Correct inline foreign_unique with target type="group" handling

Using type="inline" and MM relations having type="group" (instead of
type="select") and foreign_unique defined results in a fatal since
group db relations have been resolved to an array in TcaGroup data
provider already.

Change-Id: I20d138e7622aafb097a11e60014f9e4398bae811
Resolves: #82104
Resolves: #84735
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/58421
Tested-by: TYPO3com <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Reviewed-by: Cyril Janody <>
Tested-by: Cyril Janody <>
Reviewed-by: Anja Leichsenring <>
Tested-by: Anja Leichsenring <>

Revision f4102ffe (diff)
Added by Cyril Janody over 1 year ago

[BUGFIX] Correct inline foreign_unique with target type="group" handling

Using type="inline" and MM relations having type="group" (instead of
type="select") and foreign_unique defined results in a fatal since
group db relations have been resolved to an array in TcaGroup data
provider already.

Change-Id: I20d138e7622aafb097a11e60014f9e4398bae811
Resolves: #82104
Resolves: #84735
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/58422
Reviewed-by: Anja Leichsenring <>
Tested-by: Anja Leichsenring <>

History

#1 Updated by Ronald Kools over 2 years ago

This error occurs when using an IRRE with 'foreign_unique'.

#2 Updated by Ronald Kools over 2 years ago

  • Category deleted (Form Framework)

#3 Updated by Ronald Kools about 2 years ago

  • Category set to Extbase

#4 Updated by Tymoteusz Motylewski over 1 year ago

  • Category changed from Extbase to FormEngine aka TCEforms

changed category to the correct one

#5 Updated by Cyril Janody over 1 year ago

Hi all,

Just add a sample extension.

Simply create one or more obj1, obj2 and link them.

Will push a fix soon.

#6 Updated by Gerrit Code Review over 1 year ago

  • Status changed from New 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 https://review.typo3.org/58421

#7 Updated by Gerrit Code Review over 1 year ago

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

#8 Updated by Tymoteusz Motylewski over 1 year ago

Cyril,
Can you please do a pull request with your example to the Styleguide extenstion ?https://github.com/TYPO3/styleguide

This will make sure that its easier for everybody to test, and in the future we can test this case with never TYPO3 versions.
Please let me know if you have any questions.

#9 Updated by Gerrit Code Review over 1 year ago

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

#10 Updated by Cyril Janody over 1 year ago

Hi Timoteusz,
Pull request https://github.com/TYPO3/styleguide/pull/121
Thank you

#11 Updated by Christian Kuhn over 1 year ago

  • Related to Bug #84735: InlineControlContainer wrongly assumes group field values are still a string added

#12 Updated by Gerrit Code Review over 1 year ago

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

#13 Updated by Gerrit Code Review over 1 year ago

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

#14 Updated by Cyril Janody over 1 year ago

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

#15 Updated by Gerrit Code Review over 1 year ago

  • Status changed from Resolved to Under Review

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

#16 Updated by Cyril Janody over 1 year ago

  • Status changed from Under Review to Resolved

#17 Updated by Benni Mack 10 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF