Bug #80473

Do not bypass fetch of database record if tableName is tt_content

Added by Faton Haliti over 4 years ago. Updated about 4 years ago.

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

100%

Estimated time:
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.


Files

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

Related issues

Related to TYPO3 Core - Task #80100: Bypass fetch of database record if already loadedClosedXavier Perseguers2017-03-02

Actions
Related to TYPO3 Core - Bug #80426: Creating a FlexForm section causes exception in ajax request (none admin user)Closed2017-03-23

Actions
Related to TYPO3 Core - Bug #80825: FlexForm Sections don't get saved before the parent record was stored to the DBClosedChristian Kuhn2017-04-12

Actions
#1

Updated by Gerrit Code Review over 4 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 over 4 years ago

  • Description updated (diff)
#3

Updated by Xavier Perseguers over 4 years ago

  • Description updated (diff)
#4

Updated by Xavier Perseguers over 4 years ago

  • File editrow.png editrow.png added
  • File zone.png zone.png 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 over 4 years ago

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

#6

Updated by Gerrit Code Review over 4 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 over 4 years ago

  • Target version changed from next-patchlevel to 8 LTS
#8

Updated by Gerrit Code Review over 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 https://review.typo3.org/52174

#9

Updated by Xavier Perseguers over 4 years ago

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

Updated by Daniel Goerz over 4 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 about 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF