Bug #55256
closedInvalid class name to file path conversion
100%
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
Updated by Gerrit Code Review almost 11 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
Updated by Gerrit Code Review almost 11 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
Updated by Xavier Perseguers almost 11 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 29191fbaf43bfef279b80ab43a282c832f9bf88f.
Updated by Helmut Hummel almost 11 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.
Updated by Xavier Perseguers almost 11 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.
Updated by Helmut Hummel almost 11 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
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed