1818use TYPO3 \CMS \Backend \Utility \BackendUtility as BackendUtilityCore ;
1919use TYPO3 \CMS \Core \Configuration \Exception \ExtensionConfigurationExtensionNotConfiguredException ;
2020use TYPO3 \CMS \Core \Configuration \Exception \ExtensionConfigurationPathDoesNotExistException ;
21+ use TYPO3 \CMS \Core \Utility \ArrayUtility as CoreArrayUtility ;
2122use TYPO3 \CMS \Core \Utility \GeneralUtility ;
2223use TYPO3 \CMS \Extbase \Configuration \Exception \InvalidConfigurationTypeException ;
2324use TYPO3 \CMS \Extbase \Mvc \Exception \InvalidExtensionNameException ;
@@ -147,6 +148,9 @@ protected function getLabel(string $key): string
147148 */
148149 protected function getEditFormLink (): string
149150 {
151+ if (!CoreArrayUtility::isValidPath ($ this ->getFormProperties (), 'uid ' )) {
152+ return '' ;
153+ }
150154 return BackendUtility::createEditUri (Form::TABLE_NAME , (int )$ this ->getFormProperties ()['uid ' ]);
151155 }
152156
@@ -218,7 +222,7 @@ protected function getFormProperties(): array
218222 protected function getRelatedFormUid (): int
219223 {
220224 $ flexFormArray = (array )$ this ->data ['databaseRow ' ]['pi_flexform ' ]['data ' ]['main ' ]['lDEF ' ];
221- $ formUid = (int )$ flexFormArray ['settings.flexform.main.form ' ]['vDEF ' ][0 ];
225+ $ formUid = (int )( $ flexFormArray ['settings.flexform.main.form ' ]['vDEF ' ][0 ] ?? 0 ) ;
222226 $ language = (int )($ this ->data ['databaseRow ' ]['sys_language_uid ' ][0 ] ?? $ this ->data ['databaseRow ' ]['sys_language_uid ' ] ?? 0 );
223227 $ formUid = $ this ->getLocalizedFormUid ($ formUid , $ language );
224228 return $ formUid ;
@@ -231,7 +235,17 @@ protected function getRelatedFormUid(): int
231235 */
232236 protected function getStoragePageProperties (): array
233237 {
234- return (array )BackendUtilityCore::getRecord ('pages ' , (int )$ this ->getFormProperties ()['pid ' ], '* ' , '' , false );
238+ if (!CoreArrayUtility::isValidPath ($ this ->getFormProperties (), 'pid ' )) {
239+ return [];
240+ }
241+
242+ return (array )BackendUtilityCore::getRecord (
243+ 'pages ' ,
244+ (int )$ this ->getFormProperties ()['pid ' ],
245+ '* ' ,
246+ '' ,
247+ false
248+ );
235249 }
236250
237251 /**
@@ -248,6 +262,9 @@ protected function getRelatedPages(): array
248262 return $ this ->getRelatedPagesAlternative ();
249263 }
250264
265+ if (!CoreArrayUtility::isValidPath ($ this ->getFormProperties (), 'uid ' )) {
266+ return [];
267+ }
251268 $ queryBuilder = DatabaseUtility::getQueryBuilderForTable (Form::TABLE_NAME , true );
252269 $ rows = (array )$ queryBuilder
253270 ->select ('p.title ' )
@@ -306,6 +323,9 @@ protected function getRelatedFields(): array
306323 return $ this ->getRelatedFieldsAlternative ();
307324 }
308325
326+ if (!CoreArrayUtility::isValidPath ($ this ->getFormProperties (), 'uid ' )) {
327+ return [];
328+ }
309329 $ titles = [];
310330 $ queryBuilder = DatabaseUtility::getQueryBuilderForTable (Form::TABLE_NAME , true );
311331 $ rows = $ queryBuilder
0 commit comments