[TASK] Deprecate eID registration with a script to a file 83/57683/7
authorWouter Wolters <typo3@wouterwolters.nl>
Wed, 25 Jul 2018 18:36:45 +0000 (20:36 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Wed, 25 Jul 2018 22:08:50 +0000 (00:08 +0200)
Resolves: #85646
Releases: master
Change-Id: Ib8d550acb922c02c240f09898e4a354708a729b7
Reviewed-on: https://review.typo3.org/57683
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Documentation/Changelog/master/Deprecation-85646-DeprecateEIDImplementedAsScript.rst [new file with mode: 0644]
typo3/sysext/frontend/Classes/Middleware/EidHandler.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85646-DeprecateEIDImplementedAsScript.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85646-DeprecateEIDImplementedAsScript.rst
new file mode 100644 (file)
index 0000000..6a3a4d5
--- /dev/null
@@ -0,0 +1,44 @@
+.. include:: ../../Includes.txt
+
+=========================================================
+Deprecation: #85646 - Deprecate eID implemented as script
+=========================================================
+
+See :issue:`85646`
+
+Description
+===========
+
+Calling a frontend eID as a direct script call has been deprecated.
+
+Setting a PHP eID include like this logs deprecation warnings::
+
+    $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['myEid'] = 'EXT:myExt/Resources/Php/MyAjax.php';
+
+This is not valid anymore. Instead, a class / method combination should be used::
+
+    $GLOBALS['TYPO3_CONF_VARS']['FE']['eID_include']['myEid'] = \MyVendor\MyExt\Controller\MyEidController::class . '::myMethod';
+
+The main difference is that a script call does not execute code if calling :php:`require()` on
+it directly anymore, but needs a proper registration including an entry method to be called.
+This increases encapsulation and security.
+
+Impact
+======
+
+eIDs which are registered with a direct script includes log a deprecation message.
+
+
+Affected Installations
+======================
+
+3rd party extensions which implement eIDs with a script to a file instead of
+a class->method combination.
+
+
+Migration
+=========
+
+Register eID with a class::method syntax like :php:`\TYPO3\CMS\Frontend\MyClass::mymethod` instead.
+
+.. index:: Frontend, NotScanned
\ No newline at end of file
index a90a2b9..cf4db88 100644 (file)
@@ -65,7 +65,11 @@ class EidHandler implements MiddlewareInterface
             $request = $request->withAttribute('target', $configuration);
             return $dispatcher->dispatch($request, $response) ?? new NullResponse();
         }
             $request = $request->withAttribute('target', $configuration);
             return $dispatcher->dispatch($request, $response) ?? new NullResponse();
         }
-
+        trigger_error(
+            'eID "' . $eID . '" is registered with a script to a file. This behaviour will be removed in TYPO3 v10.'
+            . ' Register eID with a class::method syntax like "\MyVendor\MyExtension\Controller\MyEidController::myMethod" instead.',
+            E_USER_DEPRECATED
+        );
         $scriptPath = GeneralUtility::getFileAbsFileName($configuration);
         if ($scriptPath === '') {
             throw new Exception('Registered eID has invalid script path.', 1518042216);
         $scriptPath = GeneralUtility::getFileAbsFileName($configuration);
         if ($scriptPath === '') {
             throw new Exception('Registered eID has invalid script path.', 1518042216);