Project

General

Profile

Actions

Bug #55256

closed

Invalid class name to file path conversion

Added by Xavier Perseguers about 10 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Category:
Caching
Target version:
Start date:
2014-01-22
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
5.4
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

In an Extbase extension, the ClassLoader is called to store the PHP file name corresponding to a given class.

In some situations (loading of a class name from its table name - tx_extensionname_domain_model_somename), it fails to properly compute the corresponding file name as /path/to/extensionane/Classes/Domain/Model/Somename.php but computes it as /path/to/extensionname/Classes/domain/model/somename.php.

The computed filename is tested with file_exists() which will return FALSE (and give a cache miss, not dramatical) on case sensitive file systems. But on case insensitive file systems, such as by default on Mac OS X (or Windows), file_exists() will return TRUE and the pair class name <-> filename.php will be stored in typo3temp/Cache/Data/cache_classes/tx_extensionname_domain_model_somename

Now, at some point autoloader will properly load the class name without relying on this cache but \TYPO3\CMS\Extbase\Utility\TypeHandlingUtility::isCoreType(), will under certain circumstance be called. Now this method calls "is_subclass_of" which will use the cache and try to load the file.

Problem is that the corresponding class has already been loaded using its proper file name which results into a PHP fatal exception:

Fatal error: Cannot redeclare class VendorName\Extension\Domain\Model\Somename


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Bug #55418: Class Loader requires "wrong" class files if class string matches naming conventionClosed2014-01-29

Actions
Actions #1

Updated by Gerrit Code Review about 10 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26999

Actions #2

Updated by Gerrit Code Review about 10 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/26999

Actions #3

Updated by Xavier Perseguers about 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #4

Updated by Helmut Hummel about 10 years ago

Xavier Perseguers wrote:

In some situations (loading of a class name from its table name - tx_extensionname_domain_model_somename),

Does this mean the computation of the class name out of the table name is wrong?

it fails to properly compute the corresponding file name as /path/to/extensionane/Classes/Domain/Model/Somename.php but computes it as /path/to/extensionname/Classes/domain/model/somename.php.

Or is resolving the file location of the class \extensionane\Domain\Model\Somename wrong?

In the first case it should be fixed in Extbase not the class loader.

Actions #5

Updated by Xavier Perseguers about 10 years ago

The method I fixed is marked as "Extbase"-related and I don't think the faulty code is in Extbase. The code itself in this method is "correct" but really the unproper case is (well "was") just simply wrong so for me this was the right place to fix it.

Actions #6

Updated by Helmut Hummel about 10 years ago

Xavier Perseguers wrote:

The method I fixed is marked as "Extbase"-related and I don't think the faulty code is in Extbase. The code itself in this method is "correct" but really the unproper case is (well "was") just simply wrong so for me this was the right place to fix it.

Yeah. For now it is the best solution we have, besides what I changed for #54275

Actions #7

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF