[BUGFIX] Type check fix in linkhandler link type 98/26498/7
authorAlexander Stehlik <alexander.stehlik@gmail.com>
Sun, 21 Dec 2014 16:08:52 +0000 (17:08 +0100)
committerBenjamin Mack <benni@typo3.org>
Wed, 31 Dec 2014 11:32:21 +0000 (12:32 +0100)
To determine if a link should be handled by the linkhandler link type
in the linkvalidator, the "type" entry in the $value array will be
checked instead of the $type variable which is always empty.

Resolves: #38639
Releases: master, 6.2
Change-Id: I8183bfca0e4662518063f0d3ec9ba6bab0ff58bf
Reviewed-on: http://review.typo3.org/26498
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
typo3/sysext/linkvalidator/Classes/Linktype/LinkHandler.php

index 0a05462..a4ac102 100644 (file)
@@ -14,7 +14,8 @@ namespace TYPO3\CMS\Linkvalidator\Linktype;
  * The TYPO3 project - inspiring people to share!
  */
 
-use \TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * This class provides Check Link Handler plugin implementation
@@ -115,7 +116,7 @@ class LinkHandler extends \TYPO3\CMS\Linkvalidator\Linktype\AbstractLinktype {
         * @return string fetched type
         */
        public function fetchType($value, $type, $key) {
-               if ($type == 'string' && strtolower(substr($value['tokenValue'], 0, 7)) == 'record:') {
+               if ($value['type'] === 'string' && GeneralUtility::isFirstPartOfStr(strtolower($value['tokenValue']), 'record:')) {
                        $type = 'linkhandler';
                }
                return $type;