Skip to content

Fatal error: Call to a member function getFileReferences() on a non-object in … /typo3/sysext/core/Classes/Resource/Service/FrontendContentAdapterService.php on line 90

4. June 2015

PROBLEM
PHP Error:
Fatal error: Call to a member function getFileReferences() on a non-object in … /typo3/sysext/core/Classes/Resource/Service/FrontendContentAdapterService.php on line 90

CAUSE
This is where the fatal php error occurs
Why? Because self::getPageRepository() returns null instead of an object when content elements with images are involved (and EXT:speciality, EXT:fluidcontent, EXT:flux is used)

$files = self::getPageRepository()->getFileReferences($table, $migrateFieldName, $row);

SOLUTION/WORKAROUND
Replace above line with these lines

$dvsPageRepositoryObj = self::getPageRepository(); 

if ($dvsPageRepositoryObj) {
   $files = $dvsPageRepositoryObj->getFileReferences($table, $migrateFieldName, $row);
} else {
   // If $dvsPageRepositoryObj is null (e.g. not an object) return an empty array
   $files = array();
}

ENVIRONMENT
Typo3 6.2.12 + EXT:speciality (fluidcontent_core, vhs, …)
PHP 5.5.18
Mac OS X Yosemite

Advertisements

From → Typo3

Leave a Comment

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: