From af5244a5b56cd058b90820524de5984ea76f7001 Mon Sep 17 00:00:00 2001
From: Alexander Schnitzler <git@alexanderschnitzler.de>
Date: Tue, 31 Mar 2020 18:21:06 +0200
Subject: [PATCH] [TASK] Improve deprecation messages in ExtensionUtility

This patch enriches the deprecation messages with important
information such as extension, plugin and vendor name to be
able to distinguish deprecation messages from each other and
to ease the location of affected code.

Releases: master
Resolves: #90914
Change-Id: Ia6bdd7ffa7539214de41f1b55ebe83bb66190b5f
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64035
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
---
 .../extbase/Classes/Utility/ExtensionUtility.php      | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/typo3/sysext/extbase/Classes/Utility/ExtensionUtility.php b/typo3/sysext/extbase/Classes/Utility/ExtensionUtility.php
index d84f9479c405..aa71e26e8f95 100644
--- a/typo3/sysext/extbase/Classes/Utility/ExtensionUtility.php
+++ b/typo3/sysext/extbase/Classes/Utility/ExtensionUtility.php
@@ -52,11 +52,11 @@ class ExtensionUtility
         $vendorName = null;
         $delimiterPosition = strrpos($extensionName, '.');
         if ($delimiterPosition !== false) {
+            $vendorName = str_replace('.', '\\', substr($extensionName, 0, $delimiterPosition));
             trigger_error(
-                'Calling method ' . __METHOD__ . 'with argument $extensionName containing the vendor name is deprecated and will stop working in TYPO3 11.0.',
+                'Calling method ' . __METHOD__ . ' with argument $extensionName ("' . $extensionName . '") containing the vendor name ("' . $vendorName . '") is deprecated and will stop working in TYPO3 11.0.',
                 E_USER_DEPRECATED
             );
-            $vendorName = str_replace('.', '\\', substr($extensionName, 0, $delimiterPosition));
             $extensionName = substr($extensionName, $delimiterPosition + 1);
 
             if (!empty($vendorName)) {
@@ -78,7 +78,7 @@ class ExtensionUtility
                 }
             } else {
                 trigger_error(
-                    'Calling ' . __METHOD__ . ' with controller aliases in argument $controllerActions is deprecated and will stop working in TYPO3 11.0.',
+                    'Calling ' . __METHOD__ . ' for extension ("' . $extensionName . '") and plugin ("' . $pluginName . '") with controller aliases in argument $controllerActions is deprecated and will stop working in TYPO3 11.0.',
                     E_USER_DEPRECATED
                 );
                 $controllerAlias = $controllerClassName;
@@ -93,7 +93,7 @@ class ExtensionUtility
 
             if (isset($nonCacheableControllerActions[$controllerAlias]) && !empty($nonCacheableControllerActions[$controllerAlias])) {
                 trigger_error(
-                    'Calling ' . __METHOD__ . ' with controller aliases in argument $nonCacheableControllerActions is deprecated and will stop working in TYPO3 11.0.',
+                    'Calling ' . __METHOD__ . ' for extension ("' . $extensionName . '") and plugin ("' . $pluginName . '") with controller aliases in argument $nonCacheableControllerActions is deprecated and will stop working in TYPO3 11.0.',
                     E_USER_DEPRECATED
                 );
                 $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['extbase']['extensions'][$extensionName]['plugins'][$pluginName]['controllers'][$controllerClassName]['nonCacheableActions'] = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(
@@ -159,8 +159,9 @@ tt_content.' . $pluginSignature . ' {
 
         $delimiterPosition = strrpos($extensionName, '.');
         if ($delimiterPosition !== false) {
+            $vendorName = str_replace('.', '\\', substr($extensionName, 0, $delimiterPosition));
             trigger_error(
-                'Calling method ' . __METHOD__ . ' with argument $extensionName containing the vendor name is deprecated and will stop working in TYPO3 11.0.',
+                'Calling method ' . __METHOD__ . ' with argument $extensionName ("' . $extensionName . '") containing the vendor name ("' . $vendorName . '") is deprecated and will stop working in TYPO3 11.0.',
                 E_USER_DEPRECATED
             );
             $extensionName = substr($extensionName, $delimiterPosition + 1);
-- 
GitLab