Project

General

Profile

Task #40870 ยป patch_commit_3a60e55cd377.patch

Sebastian Michaelsen, 2012-09-12 16:38

View differences:

typo3/sysext/core/Classes/Autoloader.php
* @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) {
    (1-1/1)