#78977Fatal error: Failed to retrieve the reflection object in Extbase Reflection Service
Description
With fixing the caching of MethodReflection objects in #78915, there is an issue now which leads to a fatal error when trying to read the reflection properties of a MethodReflection object restored from cache.
Fatal error: ReflectionFunctionAbstract::getDocComment(): Internal error: Failed to retrieve the reflection object in /var/www/htdocs/typo3_src/typo3/sysext/extbase/Classes/Reflection/MethodReflection.php on line 120
When writing a MethodReflection object to cache, the object gets serialized. As serialize does not take care of virtual properties (such as the reflection properties), the reflection information gets lost. Trying to access reflection properties on an object resumed from cache causes the fatal error.
To fix the error it seems sufficient to call the reflection object’s __toString() method before serializing it.
Reviews 7
- TYPO3_6-2 50984[BUGFIX] Optimize cache handling in ReflectionService
- TYPO3_7-6 50980[BUGFIX] Optimize cache handling in ReflectionService
- main 50953[BUGFIX] Optimize cache handling in ReflectionService
- TYPO3_6-2 50969Revert "[BUGFIX] Reflection Cache does not save methodReflections"
- TYPO3_7-6 50968Revert "[BUGFIX] Reflection Cache does not save methodReflections"
- main 50963Revert "[BUGFIX] Reflection Cache does not save methodReflections"
- TYPO3_7-6 50967Revert "[BUGFIX] Reflection Cache does not save methodReflections"