[!!!][TASK] Use native trigger_error and ErrorHandler for deprecations 15/54015/30
authorBenni Mack <benni@typo3.org>
Fri, 8 Sep 2017 12:14:44 +0000 (14:14 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 4 Oct 2017 18:02:14 +0000 (20:02 +0200)
commit95b13dca3d5c36e7a5dbf235ad74bd5483b73fc6
tree11d6b07afd5e3cb1ba1d18e7ff4e288be3863415
parent2d95e83141fc77b96b29ac3b93a059da6d097314
[!!!][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>
41 files changed:
typo3/sysext/backend/Classes/Form/FormDataProvider/TcaFlexPrepare.php
typo3/sysext/backend/Classes/RecordList/AbstractRecordList.php
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/TcaFlexPrepareTest.php
typo3/sysext/backend/Tests/UnitDeprecated/Form/FormDataProvider/TcaFlexPrepareTest.php [new file with mode: 0644]
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/Classes/Error/ErrorHandler.php
typo3/sysext/core/Classes/Imaging/IconRegistry.php
typo3/sysext/core/Classes/Package/Package.php
typo3/sysext/core/Classes/Resource/Utility/BackendUtility.php
typo3/sysext/core/Classes/Service/AbstractService.php
typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
typo3/sysext/core/Classes/Utility/GeneralUtility.php
typo3/sysext/core/Configuration/DefaultConfiguration.php
typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml
typo3/sysext/core/Documentation/Changelog/master/Deprecation-82438-DeprecationMethods.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Utility/GeneralUtilityTest.php
typo3/sysext/extbase/Classes/Utility/ExtensionUtility.php
typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractViewHelper.php
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/AbstractViewHelperTest.php
typo3/sysext/fluid/Tests/UnitDeprecated/Core/ViewHelper/AbstractViewHelperTest.php [new file with mode: 0644]
typo3/sysext/frontend/Classes/ContentObject/ScalableVectorGraphicsContentObject.php
typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php
typo3/sysext/frontend/Classes/Page/PageRepository.php
typo3/sysext/frontend/Classes/Utility/EidUtility.php
typo3/sysext/install/Classes/Configuration/Context/CustomPreset.php
typo3/sysext/install/Classes/Configuration/Context/DebugPreset.php
typo3/sysext/install/Classes/Configuration/Context/LivePreset.php
typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/ArrayDimensionMatcher.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallStaticMatcher.php
typo3/sysext/lang/Classes/Command/LanguageUpdateCommand.php
typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php
typo3/sysext/recordlist/Classes/RecordList/DatabaseRecordList.php
typo3/sysext/recordlist/Tests/Unit/RecordList/AbstractDatabaseRecordListTest.php [deleted file]
typo3/sysext/recordlist/Tests/UnitDeprecated/RecordList/AbstractDatabaseRecordListTest.php [new file with mode: 0644]
typo3/sysext/reports/Classes/Report/Status/ConfigurationStatus.php
typo3/sysext/reports/Resources/Private/Language/locallang_reports.xlf
typo3/sysext/sys_note/Classes/Domain/Repository/SysNoteRepository.php