Bug #54275
closedClassLoader creates additional cacheidentifier for same file
100%
Description
Hello Core-Team,
I get following error message on my Mac with MAMP PRO:
PHP Fatal error: Cannot redeclare class SF\Sfcategory\Domain\Model\Car in /Applications/MAMP/htdocs/typo3_git/typo3conf/ext/sfcategory/Classes/domain/model/car.php on line 87
My extension uses Namespaces. So I have a cache entry: sf_sfcategory_domain_model_car in Cache/Data/cache_classes
But while mapping the data into Model through DataMapper Extbase tries to create a classname from tablename. On that way a classname tx_sfcategory_domain_model_car was created. So I have two entries in my cache_classes-directory with the same classpath.
Further sf_sfcategory_domain_model_car contains an ucfirst path: Classes/Domain/Model/Car.php
But tx_sfcategory_domain_model_car has following path: Classes/domain/model/car.php
Stefan
Updated by Markus Klein almost 11 years ago
@Tom,@Ernesto: Maybe this is an issue worth noting?
Updated by Stefan Froemken almost 11 years ago
As a workaround:
Create following file: typo3conf/ext/[ExtKey]/Migrations/Code/ClassAliasMap.php
with a mapping array, how to map old classnames to new namespaced classes:
<?php return array( 'tx_clubdirectory_domain_model_club' => 'JWeiland\\Clubdirectory\\Domain\\Model\\Club', 'tx_clubdirectory_domain_model_address' => 'JWeiland\\Clubdirectory\\Domain\\Model\\Address', 'tx_clubdirectory_domain_model_district' => 'JWeiland\\Clubdirectory\\Domain\\Model\\District' );
Now DataMapper knows where to map Array-data into.
Stefan
Updated by Stefan Froemken almost 11 years ago
- Assignee set to Thomas Maroschik
Hello Core-Team,
I have debugged this issue a little bit deeper. This problem exists if you work with probertyName=tablenames. sys_category is a good example.
In Typo3DbBackend->parseComparison() you have a call to getPlainValue(). In my case this value is "tx_sfcategory_domain_model_car". So in getPlainValue you have added the new TypeHandlingUtility::isCoreType. This method now tries to require_once this className and sure...it is a valid className. But this check creates a new and wrong ClassesCacheEntry: tx_sfcategory_domain_model_car.
isCoreType should never be called if propertyName is "tablenames" or do you have a better idea how to prevent checking this tablename through ClassLoader?!
Stefan
Updated by Gerrit Code Review almost 11 years ago
- Status changed from New to Under Review
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27079
Updated by Helmut Hummel almost 11 years ago
Gerrit Code Review wrote:
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27079
This fixes the Extbase part by changing gePlainValue to not trigger the class loader.
But I think the class loader should also be fixed to not load classes like "\Vendor\Ext\Foo\Bar" when class "tx_ext_foo_bar" is requested to be loaded.
Updated by Helmut Hummel almost 11 years ago
- Assignee changed from Thomas Maroschik to Helmut Hummel
Updated by Helmut Hummel almost 11 years ago
Stefan Froemken wrote:
Hello Core-Team,
I get following error message on my Mac with MAMP PRO:
PHP Fatal error: Cannot redeclare class SF\Sfcategory\Domain\Model\Car in /Applications/MAMP/htdocs/typo3_git/typo3conf/ext/sfcategory/Classes/domain/model/car.php on line 87
Can you check if my WIP change fixes your problem?
Updated by Gerrit Code Review almost 11 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27079
Updated by Gerrit Code Review almost 11 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27079
Updated by Helmut Hummel almost 11 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset b15348a421b40553ed8b32ba19e9f8bbc84f9e0d.
Updated by Riccardo De Contardi about 7 years ago
- Status changed from Resolved to Closed