Bug #65667
ObjectManager can't resolve underscored namespace classes to new PHP's native namespace classes since TYPO3 6.2.10
Status: | Resolved | Start date: | 2015-03-11 | |
---|---|---|---|---|
Priority: | Must have | Due date: | ||
Assigned To: | - | % Done: | 100% |
|
Category: | Extbase | Spent time: | - | |
Target version: | next-patchlevel | |||
TYPO3 Version: | 6.2 | Is Regression: | Yes | |
PHP Version: | Sprint Focus: | |||
Complexity: |
Description
Since TYPO3 6.2.10 the class resolving from old namespace way with underscores seems to not work with the object manager/object container anymore. This can lead to very strange problems, because the object manager instantiates singleton classes maybe twice.
Example:
$persistenceManager1 = $this->objectManager->get('TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManagerInterface'); $persistenceManager2 = $this->objectManager->get('Tx_Extbase_Persistence_ManagerInterface'); // Since TYPO3 6.2.10 results in different hash values, because they are two different instances var_dump(spl_object_hash($persistenceManager1)); var_dump(spl_object_hash($persistenceManager2)); // Thus since TYPO3 6.2.10 following comparison returns FALSE var_dump($persistenceManager1 === $persistenceManager2); // Same behavior with another example class (here with object manager) $objectManager1 = $this->objectManager->get('Tx_Extbase_Object_ObjectManagerInterface'); $objectManager2 = $this->objectManager->get('TYPO3\CMS\Extbase\Object\ObjectManagerInterface'); var_dump(spl_object_hash($objectManager1)); var_dump(spl_object_hash($objectManager2)); var_dump($objectManager1 === $objectManager2); // Returns FALSE
Best regards,
Rob
Related issues
Associated revisions
[BUGFIX] Resolve class name from aliases managed by composer
The old class loader has API to return the original class name
when given an alias. This API was not respected when implementing
composer class loading with #64361 with the result that it was
broken for all classes and aliases managed by the composer class loader.
To address this issue, the composer class loader is now injected into
the old class alias map, so that it can resolve class names from aliases
managed by it.
Related: #64361
Resolves: #65667
Releases: 6.2, master
Change-Id: If0b5098d72147fe7d76e97ee61c81d87cad72b4b
Reviewed-on: http://review.typo3.org/37825
Reviewed-by: Sascha Nowak <sascha.nowak@netlogix.de>
Tested-by: Sascha Nowak <sascha.nowak@netlogix.de>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
[BUGFIX] Resolve class name from aliases managed by composer
The old class loader has API to return the original class name
when given an alias. This API was not respected when implementing
composer class loading with #64361 with the result that it was
broken for all classes and aliases managed by the composer class loader.
To address this issue, the composer class loader is now injected into
the old class alias map, so that it can resolve class names from aliases
managed by it.
Related: #64361
Resolves: #65667
Releases: 6.2, master
Change-Id: If0b5098d72147fe7d76e97ee61c81d87cad72b4b
Reviewed-on: http://review.typo3.org/37915
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
History
#1 Updated by Markus Klein 5 months ago
- Status changed from New to Accepted
- Target version set to next-patchlevel
- Is Regression changed from No to Yes
Thanks for the report!
#2 Updated by Markus Klein 5 months ago
Bug in \TYPO3\CMS\Extbase\Object\Container\Container::getInstanceInternal()
No class alias maps available for Core classes. Seems to be related to: #64361
Another bug in the same function, IMO:
You can't instantiate
TYPO3\\CMS\\Extbase\\Object\\Container\\Container
TYPO3\\CMS\\Core\\Cache\\CacheManager
TYPO3\\CMS\\Core\\Package\\PackageManager
with the old name, because the resolution of aliases happens after the specific checks for those classes.
#3 Updated by Gerrit Code Review 5 months ago
- Status changed from Accepted to Under Review
Patch set 1 for branch TYPO3_6-2 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37825
#4 Updated by Helmut Hummel 5 months ago
@Rob: can you please test if the fix works for you?
#5 Updated by Helmut Hummel 5 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 89f9ec40f033bb6fba4bfb7263313a16d78404de.
#6 Updated by Gerrit Code Review 5 months ago
- Status changed from Resolved 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 http://review.typo3.org/37915
#7 Updated by Gerrit Code Review 5 months ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/37915
#8 Updated by Helmut Hummel 5 months ago
- Status changed from Under Review to Resolved
Applied in changeset cf02cd79bd0bf82afed268e3883425f327788f72.