PackageManager::getPackageOfObject() does not work for proxy objects
PackageManager::getPackageOfObject() fails to resolve the package of a given object if it's a proxy.
The Flow/Doctrine proxy classes usually reside in a folder underneath
Data/Temporary. Comparing those paths with the package root paths leads to invalid results.
Updated by Adrian Föder almost 8 years ago
The current implementation is still not fully well-working; now it only regards the namespace no matter where the class actually lies.
This might lead to unexpected results; already for the Migration classes which have a TYPO3\Flow namespace, but lie in a respective package of course.
TBH I think the initial implementation where the actual class location was determined, was generally the approach which more matched the expectation of the functionality; but of course with the drawback of Proxy classes not working since they live in Data/Temporary; so I think in case of proxy classes it should manually be worked around (to the least by checking instanceof \TYPO3\Flow\Object\Proxy\ProxyInterface and then taking the Namespace into account, because then it's definitely a Flow package class lying in its PSR-0 location etcpp.)
So my suggestion / opinion so far is: building it back to detecting the actual file location; and only if it seems to be a (copied) Proxy, use the NS as package determinator.