Bug #72113
closedInvalid argument warning in backend sysext
0%
Description
In TYPO3 7.6.0 and tt_products 2.8.1 I got the following PHP Warning:
#1: PHP Warning: Invalid argument supplied for foreach() in /homepages/46/d289040129/htdocs/yellow-head.de/typo3_src-7.6.0/typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php line 194 (More information) TYPO3\CMS\Core\Error\Exception thrown in file /homepages/46/d289040129/htdocs/yellow-head.de/typo3_src-7.6.0/typo3/sysext/core/Classes/Error/ErrorHandler.php in line 111. […]
which was fixed by Franz Holzinger, the tt_products author in the backend sysext as follows:
typo3/sysext/backend/Classes/Form/Container/InlineControlContainer.php Line 194
if (!empty($possibleRecords)) { foreach ($possibleRecords as $possibleRecord) { $possibleRecordsUidToTitle[$possibleRecord[1]] = $possibleRecord[0]; } }
Please apply in the next release. Thank you.
Files
Updated by A. Sheydin almost 9 years ago
Updated by Mathias Schreiber almost 9 years ago
- Category changed from Backend User Interface to FormEngine aka TCEforms
- Status changed from New to Needs Feedback
- Assignee set to Christian Kuhn
@Christian Kuhn: real bug or misuse?
Updated by A. Sheydin almost 9 years ago
Same for line 539 in InlineControlContainer.php
foreach ($possibleRecords as $p) { if (!in_array($p[1], $uniqueIds)) { $opt[] = '<option value="' . htmlspecialchars($p[1]) . '">' . htmlspecialchars($p[0]) . '</option>'; } }
changed to:
if (!empty($possibleRecords)) { foreach ($possibleRecords as $p) { if (!in_array($p[1], $uniqueIds)) { $opt[] = '<option value="' . htmlspecialchars($p[1]) . '">' . htmlspecialchars($p[0]) . '</option>'; } } }
Updated by Morton Jonuschat almost 9 years ago
- Status changed from Needs Feedback to Rejected
- Assignee deleted (
Christian Kuhn)
This is not a bug in FormEngine but in tt_products. TCA fields of type "select" need to have a renderType defined, see https://docs.typo3.org/typo3cms/extensions/core/latest/Changelog/7.6/Deprecation-69822-DeprecateSelectFieldTca.html for details.
The core implements a TcaMigration so that the old configuration in converted to the new format on the fly. For this to work TCA needs to be defined within Configuration/TCA and Configuration/TCA/Overrides - see https://docs.typo3.org/typo3cms/CoreApiReference/latest/ExtensionArchitecture/FilesAndLocations/Index.html
tt_products still declares all TCA within ext_tables.php/tca.php, so the Migrations do not get applied, thus select fields do not get processed and in the long run you end up without proper data structures.
If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.
Updated by A. Sheydin almost 9 years ago
The author arguments, that this is not a bug in tt_products, but an incompatibility introduced with TYPO3 7.6, connected with php errors in TYPO3 7.6
Workaround:
In the file tca.php the lines have to be added:
'type' => 'select',
'renderType' => 'selectSingle',
After each "'type' => 'select',"
there has to be a line "'renderType' => 'selectSingle',"
in case there is no render type.
Also the file ext_tables.php must be modified.
The document
https://docs.typo3.org/typo3cms/extensions/core/latest/Changelog/7.6/Deprecation-69822-DeprecateSelectFieldTca.html
describes it.
(Source: http://www.jambage.com/kontakt/forum/shop-system/backend/list/6967.html)
Updated by Christian Kuhn almost 9 years ago
Hey.
Setting TCA from / within ext_tables was discouraged with 6.2 already and migration of non-clean TCA for core version 7 only if ext:compatibility6 is loaded, which in turn results in a significant performance loss!
So, this is still an issue with tt_product and not in core. The extension should finally put its TCA definition out of ext_tables.php and to Configuration/TCA or Configuration/TCA/Overrides AND set the renderType for type=select TCA fields. The core PHP warning will vanish, then. This was mentioned in https://docs.typo3.org/typo3cms/extensions/core/latest/Changelog/7.3/Deprecation-67229-TcaChanges.html#impact together with an explanation of other TCA changes.