Bug #30935

Catch ViewHelper exceptions and log them in production context

Added by Bastian Waidelich almost 4 years ago. Updated about 1 month ago.

Status:Resolved Start date:2011-10-14
Priority:Should have Due date:
Assigned To:Christian Müller % Done:

100%

Category:Core
Target version:-
Has patch:No Affected Flow version:FLOW3 1.0.0

Description

from line 241 of the AbstractViewHelper:

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

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

 1try {
 2    return call_user_func_array(array($this, 'render'), $renderMethodParameters);
 3} catch (\TYPO3\Fluid\Core\ViewHelper\Exception $exception) {
 4    if ($this->objectManager->getContext() === 'Development') {
 5        return $exception->getMessage();
 6    } else {
 7        $this->systemLogger->log([...]);
 8        return '';
 9    }
10}


Related issues

related to Core - Bug #32528: imageViewHelper should not throw exception Resolved 2011-12-14
duplicates TYPO3.Fluid - Feature #9211: Improve ViewHelper exception handling Rejected 2010-08-09

Associated revisions

Revision 5fa13298
Added by Christian Müller over 3 years ago

[BUGFIX] ViewHelper Exceptions should be logged in Production

In Production context all Exceptions from ViewHelpers will be
silently logged. In Development they will be re-thrown so the global
exception handler will be triggered.

Resolves: #30935
Releases: 1.1
Change-Id: I4af4d03ff6048fcc8999f4a48d5c2897dc43fc4e

History

#1 Updated by Mr. Hudson almost 4 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 almost 4 years ago

  • Status changed from New to Under Review
  • Assigned To set to Christian Müller

#3 Updated by Karsten Dambekalns almost 4 years ago

  • Affected Flow version set to FLOW3 1.0.0

#4 Updated by Mr. Hudson over 3 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 over 3 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 over 3 years ago

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

#7 Updated by Gerrit Code Review about 1 month 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 about 1 month ago

can be closed again, sorry ^^

#9 Updated by Bastian Waidelich about 1 month ago

  • Status changed from Under Review to Resolved

No worries, thanks ;)

Also available in: Atom PDF