diff --git a/Documentation/ApiOverview/Icon/Index.rst b/Documentation/ApiOverview/Icon/Index.rst index 8f28f49553..3a6d63b9c3 100644 --- a/Documentation/ApiOverview/Icon/Index.rst +++ b/Documentation/ApiOverview/Icon/Index.rst @@ -38,6 +38,12 @@ The file needs to return a PHP configuration array with the following keys: :language: php :caption: EXT:my_extension/Configuration/Icons.php +.. attention:: + Do not overwrite the $icons variable in this file. This can lead to the error: + "Fatal error: Uncaught Error: Call to a member function exchangeArray() on array in typo3/cms-core/Classes/Package/AbstractServiceProvider.php" + (assuming you replaced the $icons variable with an array) + :ref:`As with all .php files getting included by TYPO3, you should use a closure/anonymous function to encapsulate variables. ` + .. index:: Icon API; IconProviderInterface Icon provider diff --git a/Documentation/ExtensionArchitecture/BestPractises/ConfigurationFiles.rst b/Documentation/ExtensionArchitecture/BestPractises/ConfigurationFiles.rst index 3f66ab6f14..5f1f69e962 100644 --- a/Documentation/ExtensionArchitecture/BestPractises/ConfigurationFiles.rst +++ b/Documentation/ExtensionArchitecture/BestPractises/ConfigurationFiles.rst @@ -126,8 +126,38 @@ file with all configuration of other extensions. :php:`$_EXTKEY` option **must** be kept within an extension's :ref:`ext_emconf.php ` file. -- You **do not have to** use a directly called closure function after dropping - TYPO3 v10.4 support. + +.. _configuration_php_use_closures: + +Safety with Closures +==================== +You **do not have to** use a directly called closure function after dropping +TYPO3 v10.4 support. But it is still recommended in other included files to +wrap them in a function. + +.. literalinclude:: _function_wrap.php + :language: php + +This is a list of those files where wrapping is still +recommended: + +- ext_localconf.php (kinda fine since 8.7) +- ext_tables.php (kinda fine since 8.7) +- Configuration/RequestMiddlewares.php (fixed with 13.2) +- Configuration/Backend/Routes.php (fixed with 13.2) +- Configuration/Backend/AjaxRoutes.php (fixed with 13.2) +- Configuration/Backend/Modules.php (fixed with 13.2) +- Configuration/Backend/DashboardPresets.php (fixed with 13.2) +- Configuration/Backend/DashboardPresets.php (fixed with 13.2) +- Configuration/Backend/DashboardPresets.php (fixed with 13.2) +- Configuration/ContentSecurityPolicies.php (fixed with 13.2) +- Configuration/Icons.php (fixed with 13.2) +- Configuration/ExpressionLanguage.php +- Configuration/Backend/T3editor/Modes.php +- Configuration/Backend/T3editor/Addons.php +- Configuration/Extbase/Persistence/Classes.php +- ext_emconf.php (funnily here you have to overwrite the $EM_CONF variable) + The following example contains the complete code: diff --git a/Documentation/ExtensionArchitecture/BestPractises/_function_wrap.php b/Documentation/ExtensionArchitecture/BestPractises/_function_wrap.php new file mode 100644 index 0000000000..efe2a8e05a --- /dev/null +++ b/Documentation/ExtensionArchitecture/BestPractises/_function_wrap.php @@ -0,0 +1,9 @@ +