[BUGFIX] ReflectionService must recognize short data types 11/33611/6
authorMarkus Klein <klein.t3@reelworx.at>
Wed, 29 Oct 2014 23:03:07 +0000 (00:03 +0100)
committerFrank Nägler <typo3@naegler.net>
Wed, 29 Oct 2014 23:29:11 +0000 (00:29 +0100)
Since the Core uses and embraces the usage of short data type names
like "bool" or "int", internal type checks must ensure these are
recognized as well.

This patch takes the load off the checks and implements type conversion
for these short names right into the ReflectionService, so the checks
are still done against the full names like "boolean" or "integer".

Resolves: #62547
Releases: master
Change-Id: I0d391f04f91c40035d0ff9ae314f8f5bc4d0454c
Reviewed-on: http://review.typo3.org/33611
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Frank Nägler <typo3@naegler.net>
Tested-by: Frank Nägler <typo3@naegler.net>
typo3/sysext/extbase/Classes/Reflection/ReflectionService.php

index e9726c2..bc64f98 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Extbase\Reflection;
  */
 
 use TYPO3\CMS\Core\Utility\ClassNamingUtility;
+use TYPO3\CMS\Extbase\Utility\TypeHandlingUtility;
 
 /**
  * A backport of the FLOW3 reflection service for aquiring reflection based information.
@@ -503,7 +504,14 @@ class ReflectionService implements \TYPO3\CMS\Core\SingletonInterface {
                        if (isset($methodTagsAndValues['param']) && isset($methodTagsAndValues['param'][$parameterPosition])) {
                                $explodedParameters = explode(' ', $methodTagsAndValues['param'][$parameterPosition]);
                                if (count($explodedParameters) >= 2) {
-                                       $parameterInformation['type'] = $explodedParameters[0];
+                                       if (TypeHandlingUtility::isSimpleType($explodedParameters[0])) {
+                                               // ensure that short names of simple types are resolved correctly to the long form
+                                               // this is important for all kinds of type checks later on
+                                               $typeInfo = TypeHandlingUtility::parseType($explodedParameters[0]);
+                                               $parameterInformation['type'] = $typeInfo['type'];
+                                       } else {
+                                               $parameterInformation['type'] = $explodedParameters[0];
+                                       }
                                }
                        }
                }