[TYPO3-mvc] Error with Container trying to instantiate a className (on live website)

Franz Koch typo3.RemoveForMessage at elements-net.de
Tue Nov 30 11:45:53 CET 2010


Hey there,

I'm using extbase trunk with DI on a live website already (I know it's 
not stable and take the risks) and ran in a php error today, after the 
website has been up and running fine for three days now.

Today I got the error message "Call to method 'getConstructorArguments' 
on a non Object in line 151 of class 
Tx_Extbase_Object_Container_Container". After clearing the TYPO3 cache, 
everything was fine again. Because the website is already live, I didn't 
have the time to debug this and cleared the cache immediately because I 
assumed it could be related to the reflection cache (which it somehow 
seemed to have been).

Does anybody have a clue why this could have happened? The website 
didn't change after it went live - so why did this happen three days 
later without any change to the code or the site? Probably a corrupt 
entry in the reflection cache that could not get unserialized?


To prevent that in future, should we change the cache gathering from:

private function getClassInfo($className) {
	if (!$this->cache->has($className)) {
		$this->cache->set($className, 
$this->classInfoFactory->buildClassInfoFromClassName($className));
	}
	return $this->cache->get($className);
}


to:

private function getClassInfo($className) {
	if (!$this->cache->has($className) || 
!is_object($this->cache->get($className)) {
		$this->cache->set($className, 
$this->classInfoFactory->buildClassInfoFromClassName($className));
	}
	return $this->cache->get($className);
}


Do you think that might be sufficient?
-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list