Bug #54275

ClassLoader creates additional cacheidentifier for same file

Added by Stefan Froemken over 7 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Caching
Target version:
Start date:
2013-12-07
Due date:
% Done:

100%

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

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


Related issues

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

Actions
#1

Updated by Markus Klein over 7 years ago

@Tom,@Ernesto: Maybe this is an issue worth noting?

#2

Updated by Stefan Froemken over 7 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

#3

Updated by Stefan Froemken over 7 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

#4

Updated by Gerrit Code Review over 7 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

#5

Updated by Helmut Hummel over 7 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.

#6

Updated by Helmut Hummel over 7 years ago

  • Assignee changed from Thomas Maroschik to Helmut Hummel
#7

Updated by Helmut Hummel over 7 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?

#8

Updated by Stefan Froemken over 7 years ago

Done...see review

#9

Updated by Gerrit Code Review over 7 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

#10

Updated by Gerrit Code Review over 7 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

#11

Updated by Helmut Hummel over 7 years ago

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

Updated by Riccardo De Contardi over 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF