[!!!][TASK] Use native trigger_error and ErrorHandler for deprecations
The native PHP way of triggering deprecations by a framework or applications is done via `trigger_error($deprecationMessage, E_USER_DEPRECATED)`. Previously, TYPO3 used `GeneralUtility::deprecationLog()` and similar methods to generate a custom deprecation log, however it's more flexible to use native logging through TYPO3's ErrorHandler. This solution centralizes the way to configure the place if and how deprecation logs should be written to various log destinations. This also changes the way how deprecated methods, arguments and classes are handled. The new way to deprecate code in TYPO3 is done via `trigger_error()`, the @deprecated annotation within a method only exists now for IDE support, but is not reflected anymore for the logging message. That's why the @deprecated annotation does not contain a description anymore. The methods GeneralUtility::logDeprecatedFunction() GeneralUtility::deprecationLog() GeneralUtility::getDeprecationLogFileName() GeneralUtility::logDeprecatedViewHelperAttribute() are marked as deprecated from now on. The configuration option $TYPO3_CONF_VARS[SYS][enableDeprecationLog] is removed. Deprecation messages can now be activated by adding the E_USER_DEPRECATED constant to the respective values in $TYPO3_CONF_VARS[SYS][errorHandlerErrors] (so exceptions are handled by the TYPO3 error handler) $TYPO3_CONF_VARS[SYS][syslogErrorReporting] (so exceptions are put into GeneralUtility::sysLog) $TYPO3_CONF_VARS[SYS][belogErrorReporting] (so exceptions are put into sys_log DB table) $TYPO3_CONF_VARS[SYS][exceptionalErrors] (so exceptions are thrown on a deprecation) Deprecations will still go into GeneralUtility::devLog(), if deprecations are activated via the "errorHandlerErrors" option. Tests which test explicitly for deprecated code is moved into Tests/UnitDeprecated, to ensure that the deprecated code is not throwing an exception. Resolves: #82438 Releases: master Change-Id: I6ef9a642d179001f0484c4c7678e0bec12284faf Reviewed-on: https://review.typo3.org/54015 Reviewed-by:Susanne Moog <susanne.moog@typo3.org> Tested-by:
Susanne Moog <susanne.moog@typo3.org> Tested-by:
TYPO3com <no-reply@typo3.com> Reviewed-by:
Christian Kuhn <lolli@schwarzbu.ch> Tested-by:
Christian Kuhn <lolli@schwarzbu.ch>
Showing
- typo3/sysext/backend/Classes/Form/FormDataProvider/TcaFlexPrepare.php 1 addition, 1 deletion.../backend/Classes/Form/FormDataProvider/TcaFlexPrepare.php
- typo3/sysext/backend/Classes/RecordList/AbstractRecordList.php 1 addition, 1 deletion.../sysext/backend/Classes/RecordList/AbstractRecordList.php
- typo3/sysext/backend/Classes/Template/DocumentTemplate.php 2 additions, 2 deletionstypo3/sysext/backend/Classes/Template/DocumentTemplate.php
- typo3/sysext/backend/Classes/Utility/BackendUtility.php 2 additions, 2 deletionstypo3/sysext/backend/Classes/Utility/BackendUtility.php
- typo3/sysext/backend/Classes/View/PageLayoutView.php 4 additions, 3 deletionstypo3/sysext/backend/Classes/View/PageLayoutView.php
- typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaFlexPrepareTest.php 0 additions, 212 deletions...d/Tests/Unit/Form/FormDataProvider/TcaFlexPrepareTest.php
- typo3/sysext/backend/Tests/UnitDeprecated/Form/FormDataProvider/TcaFlexPrepareTest.php 277 additions, 0 deletions...itDeprecated/Form/FormDataProvider/TcaFlexPrepareTest.php
- typo3/sysext/core/Classes/DataHandling/DataHandler.php 5 additions, 3 deletionstypo3/sysext/core/Classes/DataHandling/DataHandler.php
- typo3/sysext/core/Classes/Error/ErrorHandler.php 1 addition, 0 deletionstypo3/sysext/core/Classes/Error/ErrorHandler.php
- typo3/sysext/core/Classes/Imaging/IconRegistry.php 1 addition, 2 deletionstypo3/sysext/core/Classes/Imaging/IconRegistry.php
- typo3/sysext/core/Classes/Package/Package.php 1 addition, 3 deletionstypo3/sysext/core/Classes/Package/Package.php
- typo3/sysext/core/Classes/Resource/Utility/BackendUtility.php 2 additions, 2 deletions...3/sysext/core/Classes/Resource/Utility/BackendUtility.php
- typo3/sysext/core/Classes/Service/AbstractService.php 2 additions, 2 deletionstypo3/sysext/core/Classes/Service/AbstractService.php
- typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php 1 addition, 1 deletion...ysext/core/Classes/Utility/ExtensionManagementUtility.php
- typo3/sysext/core/Classes/Utility/GeneralUtility.php 34 additions, 36 deletionstypo3/sysext/core/Classes/Utility/GeneralUtility.php
- typo3/sysext/core/Configuration/DefaultConfiguration.php 0 additions, 1 deletiontypo3/sysext/core/Configuration/DefaultConfiguration.php
- typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml 0 additions, 3 deletions...t/core/Configuration/DefaultConfigurationDescription.yaml
- typo3/sysext/core/Documentation/Changelog/master/Deprecation-82438-DeprecationMethods.rst 45 additions, 0 deletions...Changelog/master/Deprecation-82438-DeprecationMethods.rst
- typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php 0 additions, 19 deletionstypo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
- typo3/sysext/extbase/Classes/Utility/ExtensionUtility.php 1 addition, 1 deletiontypo3/sysext/extbase/Classes/Utility/ExtensionUtility.php
Please register or sign in to comment