From f64b3c6fda60cdbe935c10d7d557a1d861829a5e Mon Sep 17 00:00:00 2001 From: Stefan Galinski <stefan.galinski@gmail.com> Date: Mon, 10 Jun 2013 19:58:42 +0200 Subject: [PATCH] [BUGFIX] Exception on thumbnail generation in TCA In order to test this you are needing a non-FAL TCA file reference field. Just reference something here, remove the reference in the filesystem again and reload the TCA of the record. An exception will be thrown, because the file isn't available anymore. Fixes: #49009 Releases: 6.2, 6.1, 6.0 Change-Id: I6eccb3ef77de703551a64f52ab3904cead517c8a Reviewed-on: https://review.typo3.org/21328 Reviewed-by: Markus Klein Reviewed-by: Alexander Opitz Reviewed-by: Ingo Pfennigstorf Tested-by: Ingo Pfennigstorf Tested-by: Markus Klein --- .../backend/Classes/Form/FormEngine.php | 30 +++++++++++++++++-- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/typo3/sysext/backend/Classes/Form/FormEngine.php b/typo3/sysext/backend/Classes/Form/FormEngine.php index eb9d11c3449d..63ef8e515a09 100644 --- a/typo3/sysext/backend/Classes/Form/FormEngine.php +++ b/typo3/sysext/backend/Classes/Form/FormEngine.php @@ -2373,8 +2373,32 @@ function ' . $evalData . '(value) { } else { $rowCopy = array(); $rowCopy[$field] = $imgPath; - $thumbnailCode = BackendUtility::thumbCode($rowCopy, $table, $field, $this->backPath, 'thumbs.php', $config['uploadfolder'], 0, ' align="middle"'); - $imgs[] = '<span class="nobr">' . $thumbnailCode . $imgPath . '</span>'; + $thumbnailCode = ''; + try { + $thumbnailCode = BackendUtility::thumbCode( + $rowCopy, $table, $field, $this->backPath, 'thumbs.php', + $config['uploadfolder'], 0, ' align="middle"' + ); + $thumbnailCode = '<span class="nobr">' . $thumbnailCode . $imgPath . '</span>'; + + } catch (\Exception $exception) { + /** @var $flashMessage FlashMessage */ + $message = $exception->getMessage(); + $flashMessage = GeneralUtility::makeInstance( + 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage', + htmlspecialchars($message), '', FlashMessage::ERROR, TRUE + ); + $class = 'TYPO3\\CMS\\Core\\Messaging\\FlashMessageService'; + /** @var $flashMessageService \TYPO3\CMS\Core\Messaging\FlashMessageService */ + $flashMessageService = GeneralUtility::makeInstance($class); + $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier(); + $defaultFlashMessageQueue->enqueue($flashMessage); + + $logMessage = $message . ' (' . $table . ':' . $row['uid'] . ')'; + GeneralUtility::sysLog($logMessage, 'core', GeneralUtility::SYSLOG_SEVERITY_WARNING); + } + + $imgs[] = $thumbnailCode; } } $thumbsnail = implode('<br />', $imgs); @@ -6312,4 +6336,4 @@ function ' . $evalData . '(value) { } -?> \ No newline at end of file +?> -- GitLab