diff --git a/typo3/sysext/core/Classes/Autoloader.php b/typo3/sysext/core/Classes/Autoloader.php index 70f198012d30750152b91fbfe47260fb4bb48060..9d2c84281cf86faa656adaa65da66922d5fd632d 100644 --- a/typo3/sysext/core/Classes/Autoloader.php +++ b/typo3/sysext/core/Classes/Autoloader.php @@ -273,34 +273,15 @@ class Autoloader { * @return void */ static protected function attemptToLoadRegistryWithNamingConventionForGivenClassName($className) { - $delimiter = '_'; - $tempClassName = $className; - // To handle namespaced class names, get rid of the first backslash - // and replace the remaining ones with underscore. This will simulate - // a 'usual' "extbase" structure like 'Tx_ExtensionName_Foo_bar' - if (strpos($className, '\\') !== FALSE) { - $tempClassName = ltrim($className, '\\'); - $delimiter = '\\'; - } - $classNameParts = explode($delimiter, $tempClassName, 4); - if ((isset($classNameParts[0]) && $classNameParts[0] === 'TYPO3') && (isset($classNameParts[1]) && $classNameParts[1] === 'CMS')) { - $extensionKey = \TYPO3\CMS\Core\Utility\GeneralUtility::camelCaseToLowerCaseUnderscored($classNameParts[2]); - $classNameWithoutVendorAndProduct = $classNameParts[3]; - } else { - $extensionKey = \TYPO3\CMS\Core\Utility\GeneralUtility::camelCaseToLowerCaseUnderscored($classNameParts[1]); - $classNameWithoutVendorAndProduct = $classNameParts[2]; - - if (isset($classNameParts[3])) { - $classNameWithoutVendorAndProduct .= $delimiter . $classNameParts[3]; - } - } - + $extensionKey = \TYPO3\CMS\Core\Extension\ExtensionManager::getExtensionKeyFromClassName($className); if ($extensionKey) { try { // This will throw a BadFunctionCallException if the extension is not loaded $extensionPath = \TYPO3\CMS\Core\Extension\ExtensionManager::extPath($extensionKey); - $classPath = (substr(strtolower($classNameWithoutVendorAndProduct), 0, 5) === 'tests') ? '' : 'Classes/'; - $classFilePathAndName = $extensionPath . $classPath . strtr($classNameWithoutVendorAndProduct, $delimiter, '/') . '.php'; + $classNameWithoutVendorAndProduct = \TYPO3\CMS\Core\Extension\ExtensionManager::getClassNameWithoutVendorAndProduct($className); + $classesRootPath = (substr(strtolower($classNameWithoutVendorAndProduct), 0, 5) === 'tests') ? '' : 'Classes/'; + $relativeClassPath = strtr($classNameWithoutVendorAndProduct, (strpos($className, '\\') !== FALSE) ? '\\' : '_' , '/') . '.php'; + $classFilePathAndName = $extensionPath . $classesRootPath . $relativeClassPath; self::addClassToCache($classFilePathAndName, $className); } catch (\BadFunctionCallException $exception) {