Bug #30935

Catch ViewHelper exceptions and log them in production context

Added by Bastian Waidelich about 10 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Should have
Category:
Core
Target version:
-
Start date:
2011-10-14
Due date:
% Done:

100%

Estimated time:
Has patch:
No

Description

from line 241 of the AbstractViewHelper:

try {
    return call_user_func_array(array($this, 'render'), $renderMethodParameters);
} catch (\TYPO3\Fluid\Core\ViewHelper\Exception $exception) {
    // @todo [BW] rethrow exception, log, ignore.. depending on the current context
    return $exception->getMessage();
}

As the todo comment states, this should be caught in production context and logged to prevent information disclosure.
Code could look something like:

try {
    return call_user_func_array(array($this, 'render'), $renderMethodParameters);
} catch (\TYPO3\Fluid\Core\ViewHelper\Exception $exception) {
    if ($this->objectManager->getContext() === 'Development') {
        return $exception->getMessage();
    } else {
        $this->systemLogger->log([...]);
        return '';
    }
}


Related issues

Related to TYPO3 Core - Bug #32528: imageViewHelper should not throw exceptionClosed2011-12-14

Actions
Is duplicate of TYPO3.Fluid - Feature #9211: Improve ViewHelper exception handlingRejected2010-08-09

Actions
#1

Updated by Mr. Hudson about 10 years ago

Patch set 2 of change I4af4d03ff6048fcc8999f4a48d5c2897dc43fc4e has been pushed to the review server.
It is available at http://review.typo3.org/5808

#2

Updated by Christian Müller about 10 years ago

  • Status changed from New to Under Review
  • Assignee set to Christian Müller
#4

Updated by Mr. Hudson almost 10 years ago

Patch set 3 of change I4af4d03ff6048fcc8999f4a48d5c2897dc43fc4e has been pushed to the review server.
It is available at http://review.typo3.org/5808

#5

Updated by Mr. Hudson almost 10 years ago

Patch set 4 of change I4af4d03ff6048fcc8999f4a48d5c2897dc43fc4e has been pushed to the review server.
It is available at http://review.typo3.org/5808

#6

Updated by Christian Müller almost 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#7

Updated by Gerrit Code Review over 6 years ago

  • Status changed from Resolved to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at http://review.typo3.org/40212

#8

Updated by Helmut Hummel over 6 years ago

can be closed again, sorry ^^

#9

Updated by Bastian Waidelich over 6 years ago

  • Status changed from Under Review to Resolved

No worries, thanks ;)

Also available in: Atom PDF