Issue Bug Closed

#55256Invalid class name to file path conversion

Xavier Perseguers 01/22/14, 18:13 updated 10/23/17, 21:41

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

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.