Project

General

Profile

Actions

Bug #65803

closed

ClassLoader Bug with psr-0 autoload configuration - results in double slashes in filepath!

Added by Frank Rakow over 9 years ago. Updated about 9 years ago.

Status:
Rejected
Priority:
Must have
Assignee:
-
Category:
composer
Target version:
-
Start date:
2015-03-18
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

In an extension configure the composer.json with 'psr-0' autoload

  ...
  "autoload": {
    "psr-0": {
      "Vendor\\NameSpace\\": "Classes/" 
    }
  }
  ...

Bug is located in class TYPO3\CMS\Core\Core\ClassLoader in method buildClassLoadingInformationForClassFromRegisteredPackages

  ..
  if ($packageData['substituteNamespaceInPath']) {
    // If it's a TYPO3 package, classes don't comply to PSR-0.
    // The namespace part is substituted.
    $classPathAndFilename = '/' . str_replace('\\', '/', ltrim(substr($className, $packageData['namespaceLength']), '\\')) . '.php';
  } else {
  ...
  ...
  } else {
    $classPathAndFilename = $packageData['classesPath'] . $classPathAndFilename;
  }
  ...

$classPathAndFilename is created with a beginning slash - that's wrong,
because the classesPath in $packageData['classesPath'] is always ending with a slash - it's filtered with Files::getNormalizedPath!

Bugfix

    $classPathAndFilename = str_replace('\\', '/', ltrim(substr($className, $packageData['namespaceLength']), '\\')) . '.php';

Files

changes.diff (278 Bytes) changes.diff Frank Rakow, 2015-03-18 13:28
Actions #1

Updated by Wouter Wolters over 9 years ago

  • Status changed from New to Needs Feedback

Hi, can you try 7.3 or master?

The TYPO3 classloader is gone now in favor of the composer classloader.

Actions #2

Updated by Helmut Hummel over 9 years ago

  • Category set to 1594

Current state is, that we only support psr-4 in non composer mode, and anything composer is capable of in composer mode.

Actions #3

Updated by Helmut Hummel about 9 years ago

  • Status changed from Needs Feedback to Rejected

This will not be fixed in 6.2 and in master the code is gone anyway.

but psr-0 will not be supported in non composer mode

Actions

Also available in: Atom PDF