Bug #80473

Do not bypass fetch of database record if tableName is tt_content

Added by Faton Haliti almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
-
Target version:
Start date:
2017-03-27
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

In the case that one have a custom extension which has flexform and use section which will allow the user to select between possible arrays of objects to create in the form

How to reproduce:
1. Use e.g. (ext:news "composer require georgringer/news")
2. Inside flexform_news.xml in general settings part inside <el> add the code bellow

<testElement>
                        <section>1</section>
                        <type>array</type>
                        <el>
                            <record>
                                <type>array</type>
                                <el>
                                    <question>
                                        <TCEforms>
                                            <label>Question</label>
                                            <config>
                                                <type>input</type>
                                            </config>
                                        </TCEforms>
                                    </question>
                                    <answer1>
                                        <TCEforms>
                                            <label>Answer 1</label>
                                            <config>
                                                <type>input</type>
                                            </config>
                                        </TCEforms>
                                    </answer1>
                                    <answer2>
                                        <TCEforms>
                                            <label>Answer 2</label>
                                            <config>
                                                <type>input</type>
                                            </config>
                                        </TCEforms>
                                    </answer2>
                                    <answer3>
                                        <TCEforms>
                                            <label>Answer 3</label>
                                            <config>
                                                <type>input</type>
                                            </config>
                                        </TCEforms>
                                    </answer3>
                                    <correctanswer>
                                        <TCEforms>
                                            <label>Correct Answer</label>
                                            <config>
                                                <type>radio</type>
                                                <items type="array">
                                                    <numIndex index="0" type="array">
                                                        <numIndex index="0">1</numIndex>
                                                        <numIndex index="1">1</numIndex>
                                                    </numIndex>
                                                    <numIndex index="1" type="array">
                                                        <numIndex index="0">X</numIndex>
                                                        <numIndex index="1">2</numIndex>
                                                    </numIndex>
                                                    <numIndex index="2" type="array">
                                                        <numIndex index="0">2</numIndex>
                                                        <numIndex index="1">3</numIndex>
                                                    </numIndex>
                                                </items>
                                                <default>1</default>
                                            </config>
                                        </TCEforms>
                                    </correctanswer>
                                </el>
                            </record>
                        </el>
                    </testElement>

3. In a specific page under "plugin settings" you have a button with the data added in flexform_news.xml "<testElement>...</testElement>"

Result: Don't show the specific options added in flexform when you click the button.
Expected result: Show the specific options added in flexform when you click the button.

This specific XML structure (the so-called "FlexForm") is stored in the pi_flexform "tt_content" database table which then provides additional form fields in the backend.
With the latest changes on [[#80100]] this will fail because will bypass the fetch of database record if already loaded.

The suggested change is to check if the tableName is not "tt_content" and not bypass the fetch of database record.

editrow.png View (153 KB) Xavier Perseguers, 2017-03-27 17:26

zone.png View (2.97 KB) Xavier Perseguers, 2017-03-27 17:26


Related issues

Related to TYPO3 Core - Task #80100: Bypass fetch of database record if already loaded Closed 2017-03-02
Related to TYPO3 Core - Bug #80426: Creating a FlexForm section causes exception in ajax request (none admin user) Closed 2017-03-23
Related to TYPO3 Core - Bug #80825: FlexForm Sections don't get saved before the parent record was stored to the DB Closed 2017-04-12

Associated revisions

Revision ff0b0832 (diff)
Added by Xavier Perseguers almost 3 years ago

[BUGFIX] Remove partial row initialization in FlexForm sections

Since #80100, database row should not be partially initialized before
calling DatabaseEditRow form data provider. This changes removes the
partial row initialization with only the corresponding "uid" which is
not needed anyway.

Resolves: #80473
Resolves: #80426
Related: #80100
Releases: master
Change-Id: Iadf180a0c52e36989afcb2a59ff7746a60e81bfb
Reviewed-on: https://review.typo3.org/52174
Tested-by: TYPO3com <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>
Reviewed-by: Thomas Hohn <>
Reviewed-by: Frank Naegler <>
Tested-by: Frank Naegler <>
Reviewed-by: Jan Helke <>

History

#1 Updated by Gerrit Code Review almost 3 years 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/52174

#2 Updated by Faton Haliti almost 3 years ago

  • Description updated (diff)

#3 Updated by Xavier Perseguers almost 3 years ago

  • Description updated (diff)

#4 Updated by Xavier Perseguers almost 3 years ago

  • File editrow.png View added
  • File zone.png View added
  • Status changed from Under Review to Accepted
  • Priority changed from Should have to Must have
  • Target version set to next-patchlevel

A few more info regarding this bug. I could reproduce with the suggested FlexForm.

This is how it looks like:

When clicking the "+" icon, the AJAX call goes into our change with a databaseRow actually already containing some useless info since it wouldn't fail if it were empty since only the vanillaUid column is useful in this method.

Stack trace:

I don't really like the suggested fix, I'd prefer to check why only the "uid" is populated in the first place and see whether we could just omit this partial initialisation instead.

#5 Updated by Xavier Perseguers almost 3 years ago

The database row is initialized from \TYPO3\CMS\Backend\Controller\FormFlexAjaxController::containerAdd at line 74.

#6 Updated by Gerrit Code Review almost 3 years ago

  • Status changed from Accepted to Under Review

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/52174

#7 Updated by Faton Haliti almost 3 years ago

  • Target version changed from next-patchlevel to 8 LTS

#8 Updated by Gerrit Code Review almost 3 years 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/52174

#9 Updated by Xavier Perseguers almost 3 years ago

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

#10 Updated by Daniel Goerz almost 3 years ago

  • Related to Bug #80825: FlexForm Sections don't get saved before the parent record was stored to the DB added

#11 Updated by Riccardo De Contardi over 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF